diff options
author | Razvan Becheriu <razvan@isc.org> | 2023-12-20 20:16:01 +0100 |
---|---|---|
committer | Razvan Becheriu <razvan@isc.org> | 2024-01-22 16:33:26 +0100 |
commit | 72f330320bd4e40c29a0c40d56bb9cba339dce12 (patch) | |
tree | cf43cf06d371f39036dc5cdcacc5c5f1e6fd09ed /src/lib/cc/data.cc | |
parent | [#3119] use auto const& whenever possible (diff) | |
download | kea-72f330320bd4e40c29a0c40d56bb9cba339dce12.tar.xz kea-72f330320bd4e40c29a0c40d56bb9cba339dce12.zip |
[#3119] replace const auto with auto const
Diffstat (limited to 'src/lib/cc/data.cc')
-rw-r--r-- | src/lib/cc/data.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc index 8350462844..abcb0fbc4f 100644 --- a/src/lib/cc/data.cc +++ b/src/lib/cc/data.cc @@ -1122,7 +1122,7 @@ MapElement::equals(const Element& other) const { if (size() != other.size()) { return (false); } - for (const auto& kv : mapValue()) { + for (auto const& kv : mapValue()) { auto key = kv.first; if (other.contains(key)) { if (!get(key)->equals(*other.get(key))) { @@ -1156,7 +1156,7 @@ removeIdentical(ElementPtr a, ConstElementPtr b) { // over a checking for identical entries in b or vice-versa. As elements // are removed from a if a match is found, we choose to iterate over b to // avoid problems with element removal affecting the iterator. - for (const auto& kv : b->mapValue()) { + for (auto const& kv : b->mapValue()) { auto key = kv.first; if (a->contains(key)) { if (a->get(key)->equals(*b->get(key))) { @@ -1178,7 +1178,7 @@ removeIdentical(ConstElementPtr a, ConstElementPtr b) { isc_throw(TypeError, "Non-map Elements passed to removeIdentical"); } - for (const auto& kv : a->mapValue()) { + for (auto const& kv : a->mapValue()) { auto key = kv.first; if (!b->contains(key) || !a->get(key)->equals(*b->get(key))) { @@ -1196,7 +1196,7 @@ merge(ElementPtr element, ConstElementPtr other) { isc_throw(TypeError, "merge arguments not MapElements"); } - for (const auto& kv : other->mapValue()) { + for (auto const& kv : other->mapValue()) { auto key = kv.first; auto value = kv.second; if (value && value->getType() != Element::null) { @@ -1249,7 +1249,7 @@ mergeDiffAdd(ElementPtr& element, ElementPtr& other, } if (element->getType() == Element::map) { - for (const auto& kv : other->mapValue()) { + for (auto const& kv : other->mapValue()) { auto current_key = kv.first; auto value = boost::const_pointer_cast<Element>(kv.second); if (value && value->getType() != Element::null) { @@ -1318,7 +1318,7 @@ mergeDiffDel(ElementPtr& element, ElementPtr& other, // If the resulting element still contains data, we need to restore the // key parameters, so we store them here. ElementPtr new_elements = Element::createMap(); - for (const auto& kv : other->mapValue()) { + for (auto const& kv : other->mapValue()) { auto current_key = kv.first; auto value = boost::const_pointer_cast<Element>(kv.second); if (value && value->getType() != Element::null) { @@ -1349,7 +1349,7 @@ mergeDiffDel(ElementPtr& element, ElementPtr& other, } // If the element still contains data, restore the key elements. if (element->size()) { - for (const auto& kv : new_elements->mapValue()) { + for (auto const& kv : new_elements->mapValue()) { element->set(kv.first, kv.second); } } @@ -1389,7 +1389,7 @@ extend(const std::string& container, const std::string& extension, } if (element->getType() == Element::map) { - for (const auto& kv : other->mapValue()) { + for (auto const& kv : other->mapValue()) { auto current_key = kv.first; auto value = boost::const_pointer_cast<Element>(kv.second); if (value && value->getType() != Element::null) { @@ -1428,7 +1428,7 @@ copy(ConstElementPtr from, int level) { return (ElementPtr(new StringElement(from->stringValue()))); } else if (from_type == Element::list) { ElementPtr result = ElementPtr(new ListElement()); - for (const auto& elem : from->listValue()) { + for (auto const& elem : from->listValue()) { if (level == 0) { result->add(elem); } else { @@ -1438,7 +1438,7 @@ copy(ConstElementPtr from, int level) { return (result); } else if (from_type == Element::map) { ElementPtr result = ElementPtr(new MapElement()); - for (const auto& kv : from->mapValue()) { + for (auto const& kv : from->mapValue()) { auto key = kv.first; auto value = kv.second; if (level == 0) { @@ -1517,7 +1517,7 @@ isEquivalent0(ConstElementPtr a, ConstElementPtr b, unsigned level) { return (false); } // iterate on the first map - for (const auto& kv : a->mapValue()) { + for (auto const& kv : a->mapValue()) { // get the b value for the given keyword and recurse ConstElementPtr item = b->get(kv.first); if (!item || !isEquivalent0(kv.second, item, level - 1)) { @@ -1565,7 +1565,7 @@ prettyPrint(ConstElementPtr element, std::ostream& out, out << "[" << (complex ? "\n" : " "); // iterate on items - const auto& l = element->listValue(); + auto const& l = element->listValue(); for (auto it = l.begin(); it != l.end(); ++it) { // add the separator if not the first item if (it != l.begin()) { @@ -1597,7 +1597,7 @@ prettyPrint(ConstElementPtr element, std::ostream& out, out << "{\n"; // iterate on keyword: value - const auto& m = element->mapValue(); + auto const& m = element->mapValue(); bool first = true; for (auto it = m.begin(); it != m.end(); ++it) { // add the separator if not the first item |