diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-14 19:27:53 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-15 15:51:29 +0100 |
commit | f31939f3c6ca328917c6316440386c0ac6b91fc4 (patch) | |
tree | 4db15cac33cd341d66ffe4126fe7e1af2e23437f /document | |
parent | f97f1f8d65c53128a98a497a8e3299d6b4abc41f (diff) |
C++11 for loops and include canonize.
Diffstat (limited to 'document')
3 files changed, 7 insertions, 14 deletions
diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.cpp b/document/src/vespa/document/fieldvalue/fieldvalue.cpp index b8b3e2d0308..6acb3b8e97d 100644 --- a/document/src/vespa/document/fieldvalue/fieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/fieldvalue.cpp @@ -231,10 +231,8 @@ std::string FieldValue::IteratorHandler::toString(const VariableMap& vars) { std::ostringstream out; out << "[ "; - for (FieldValue::IteratorHandler::VariableMap::const_iterator iter = vars.begin(); - iter != vars.end(); - iter++) { - out << iter->first << "=" << iter->second.toString() << " "; + for (const auto & entry : vars) { + out << entry.first << "=" << entry.second.toString() << " "; } out << "]"; return out.str(); diff --git a/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp index 1fc54b8325f..6a8bce86885 100644 --- a/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/structuredfieldvalue.cpp @@ -1,9 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/document/fieldvalue/structuredfieldvalue.hpp> -#include <vespa/document/base/field.h> -#include <vespa/document/fieldvalue/fieldvalues.h> -#include <vespa/vespalib/util/exceptions.h> +#include "structuredfieldvalue.hpp" +#include "fieldvalues.h" #include <vespa/log/log.h> LOG_SETUP(".document.fieldvalue.structured"); @@ -160,11 +158,8 @@ StructuredFieldValue::onIterateNested( } } - for (std::vector<const Field*>::iterator - i = fieldsToRemove.begin(), last = fieldsToRemove.end(); - i != last; ++i) - { - const_cast<StructuredFieldValue&>(*this).remove(**i); + for (const Field * toRemove : fieldsToRemove){ + const_cast<StructuredFieldValue&>(*this).remove(*toRemove); } } diff --git a/document/src/vespa/document/fieldvalue/structuredfieldvalue.h b/document/src/vespa/document/fieldvalue/structuredfieldvalue.h index e0534a6d037..29b98c7d3ee 100644 --- a/document/src/vespa/document/fieldvalue/structuredfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/structuredfieldvalue.h @@ -10,8 +10,8 @@ */ #pragma once +#include "fieldvalue.h" #include <vespa/document/base/field.h> -#include <vespa/document/fieldvalue/fieldvalue.h> namespace document { |