| 552 | |
| 553 | |
| 554 | void ResourceLimits::set( |
| 555 | const std::string& name, const Value::Scalar& scalar) |
| 556 | { |
| 557 | // Find the location to insert while maintaining |
| 558 | // alphabetical ordering. Don't bother binary searching |
| 559 | // since we don't expect a large number of limits. |
| 560 | auto it = limits.begin(); |
| 561 | for (; it != limits.end(); ++it) { |
| 562 | if (it->first == name) { |
| 563 | // Overwrite if it exists. |
| 564 | it->second = scalar; |
| 565 | return; |
| 566 | } |
| 567 | |
| 568 | if (it->first > name) { |
| 569 | break; |
| 570 | } |
| 571 | } |
| 572 | |
| 573 | it = limits.insert(it, std::make_pair(name, scalar)); |
| 574 | } |
| 575 | |
| 576 | |
| 577 | ostream& operator<<( |
no test coverage detected