Skip to content

Commit

Permalink
[clang-tidy] use auto (jbeder#888)
Browse files Browse the repository at this point in the history
Found with modernize-use-auto

Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb authored Jun 16, 2020
1 parent 0b0bf35 commit a7a7908
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/directives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Directives::Directives() : version{true, 1, 2}, tags{} {}

const std::string Directives::TranslateTagHandle(
const std::string& handle) const {
std::map<std::string, std::string>::const_iterator it = tags.find(handle);
auto it = tags.find(handle);
if (it == tags.end()) {
if (handle == "!!")
return "tag:yaml.org,2002:";
Expand Down
9 changes: 4 additions & 5 deletions src/node_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ void node_data::compute_seq_size() const {
}

void node_data::compute_map_size() const {
kv_pairs::iterator it = m_undefinedPairs.begin();
auto it = m_undefinedPairs.begin();
while (it != m_undefinedPairs.end()) {
kv_pairs::iterator jt = std::next(it);
auto jt = std::next(it);
if (it->first->is_defined() && it->second->is_defined())
m_undefinedPairs.erase(it);
it = jt;
Expand Down Expand Up @@ -248,9 +248,8 @@ bool node_data::remove(node& key, const shared_memory_holder& /* pMemory */) {
if (m_type != NodeType::Map)
return false;

for (kv_pairs::iterator it = m_undefinedPairs.begin();
it != m_undefinedPairs.end();) {
kv_pairs::iterator jt = std::next(it);
for (auto it = m_undefinedPairs.begin(); it != m_undefinedPairs.end();) {
auto jt = std::next(it);
if (it->first->is(key))
m_undefinedPairs.erase(it);
it = jt;
Expand Down
4 changes: 2 additions & 2 deletions src/nodeevents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void NodeEvents::AliasManager::RegisterReference(const detail::node& node) {

anchor_t NodeEvents::AliasManager::LookupAnchor(
const detail::node& node) const {
AnchorByIdentity::const_iterator it = m_anchorByIdentity.find(node.ref());
auto it = m_anchorByIdentity.find(node.ref());
if (it == m_anchorByIdentity.end())
return 0;
return it->second;
Expand Down Expand Up @@ -92,7 +92,7 @@ void NodeEvents::Emit(const detail::node& node, EventHandler& handler,
}

bool NodeEvents::IsAliased(const detail::node& node) const {
RefCount::const_iterator it = m_refCount.find(node.ref());
auto it = m_refCount.find(node.ref());
return it != m_refCount.end() && it->second > 1;
}
} // namespace YAML
2 changes: 1 addition & 1 deletion src/singledocparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ anchor_t SingleDocParser::RegisterAnchor(const std::string& name) {

anchor_t SingleDocParser::LookupAnchor(const Mark& mark,
const std::string& name) const {
Anchors::const_iterator it = m_anchors.find(name);
auto it = m_anchors.find(name);
if (it == m_anchors.end())
throw ParserException(mark, ErrorMsg::UNKNOWN_ANCHOR);

Expand Down

0 comments on commit a7a7908

Please sign in to comment.