[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 8bc2e40 2/3: Modernize for statements
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 8bc2e40 2/3: Modernize for statements |
Date: |
Thu, 19 Jan 2017 09:27:46 +0000 (UTC) |
branch: master
commit 8bc2e4047042caba527510eda3b271336f96d98b
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Modernize for statements
---
input_seq_helpers.cpp | 9 ++-------
input_seq_helpers.hpp | 15 ++++-----------
single_cell_document.cpp | 9 +++------
xml_lmi.cpp | 9 ++++-----
xml_serializable.tpp | 15 ++++++---------
5 files changed, 19 insertions(+), 38 deletions(-)
diff --git a/input_seq_helpers.cpp b/input_seq_helpers.cpp
index 9581ee2..c142060 100644
--- a/input_seq_helpers.cpp
+++ b/input_seq_helpers.cpp
@@ -30,14 +30,9 @@ namespace detail
)
{
std::vector<std::string> keywords;
- stringmap_iterator i_keyword_dictionary = keyword_dictionary.begin();
- for
- (
- ;i_keyword_dictionary != keyword_dictionary.end()
- ;++i_keyword_dictionary
- )
+ for(auto const& i : keyword_dictionary)
{
- keywords.push_back((*i_keyword_dictionary).first);
+ keywords.push_back(i.first);
}
return keywords;
}
diff --git a/input_seq_helpers.hpp b/input_seq_helpers.hpp
index 5ac3b5d..246feb9 100644
--- a/input_seq_helpers.hpp
+++ b/input_seq_helpers.hpp
@@ -44,11 +44,6 @@ namespace detail
stringmap
;
- typedef
- std::map<std::string, std::string, std::less<std::string>
>::const_iterator
- stringmap_iterator
- ;
-
std::vector<std::string> LMI_SO extract_keys_from_string_map
(stringmap const& keyword_dictionary
);
@@ -113,10 +108,9 @@ std::vector<T> convert_vector_type
)
{
std::vector<T> z;
- typename std::vector<mc_enum<T> >::const_iterator ve_i;
- for(ve_i = ve.begin(); ve_i != ve.end(); ++ve_i)
+ for(auto const& i : ve)
{
- z.push_back(ve_i->value());
+ z.push_back(i.value());
}
return z;
}
@@ -127,10 +121,9 @@ std::vector<Number> convert_vector_type
)
{
std::vector<Number> z;
- typename std::vector<tn_range<Number,Trammel> >::const_iterator vr_i;
- for(vr_i = vr.begin(); vr_i != vr.end(); ++vr_i)
+ for(auto const& i : vr)
{
- z.push_back(vr_i->value());
+ z.push_back(i.value());
}
return z;
}
diff --git a/single_cell_document.cpp b/single_cell_document.cpp
index c965a77..0903210 100644
--- a/single_cell_document.cpp
+++ b/single_cell_document.cpp
@@ -152,16 +152,13 @@ bool
single_cell_document::data_source_is_external(xml::document const& d) const
// INPUT !! Remove "InforceDataSource" and the following code when
// external systems are updated to use the "data_source" attribute.
- typedef xml::const_nodes_view::const_iterator cnvi;
-
xml::const_nodes_view const i_nodes(root.elements("cell"));
LMI_ASSERT(1 == i_nodes.size());
- for(cnvi i = i_nodes.begin(); i != i_nodes.end(); ++i)
+ for(auto const& i : i_nodes)
{
- xml::const_nodes_view const j_nodes(i->elements("InforceDataSource"));
- for(cnvi j = j_nodes.begin(); j != j_nodes.end(); ++j)
+ for(auto const& j : i.elements("InforceDataSource"))
{
- std::string s(xml_lmi::get_content(*j));
+ std::string s(xml_lmi::get_content(j));
if("0" != s && "1" != s)
{
return true;
diff --git a/xml_lmi.cpp b/xml_lmi.cpp
index cca5fb5..098d6cf 100644
--- a/xml_lmi.cpp
+++ b/xml_lmi.cpp
@@ -278,15 +278,14 @@ std::string get_content(xml::element const& element)
try
{
std::string s;
- typedef xml::node::const_iterator NodeConstIterator;
- for(NodeConstIterator i = element.begin(); i != element.end(); ++i)
+ for(auto const& i : element)
{
- if(i->is_text())
+ if(i.is_text())
{
- char const* content = i->get_content();
+ char const* content = i.get_content();
if(content)
{
- s += i->get_content();
+ s += i.get_content();
}
}
}
diff --git a/xml_serializable.tpp b/xml_serializable.tpp
index 8b4fb45..9260d7d 100644
--- a/xml_serializable.tpp
+++ b/xml_serializable.tpp
@@ -108,11 +108,9 @@ void xml_serializable<T>::read(xml::element const& x)
);
std::list<std::string>::iterator current_member;
- xml::const_nodes_view const elements(x.elements());
- typedef xml::const_nodes_view::const_iterator cnvi;
- for(cnvi child = elements.begin(); child != elements.end(); ++child)
+ for(auto const& child : x.elements())
{
- std::string node_tag(child->get_name());
+ std::string node_tag(child.get_name());
current_member = std::find
(residuary_names.begin()
,residuary_names.end()
@@ -120,13 +118,13 @@ void xml_serializable<T>::read(xml::element const& x)
);
if(residuary_names.end() != current_member)
{
- read_element(*child, node_tag, file_version);
+ read_element(child, node_tag, file_version);
residuary_names.erase(current_member);
}
else if(is_detritus(node_tag))
{
// Hold certain obsolete entities that must be translated.
- value_type v = fetch_element(*child);
+ value_type v = fetch_element(child);
redintegrate_ex_ante(file_version, node_tag, v);
detritus_map[node_tag] = v;
}
@@ -182,10 +180,9 @@ void xml_serializable<T>::immit_members_into(xml::element&
root) const
{
xml_lmi::set_attr(root, "version", class_version());
- std::vector<std::string>::const_iterator i;
- for(i = t().member_names().begin(); i != t().member_names().end(); ++i)
+ for(auto const& i : t().member_names())
{
- write_element(root, *i);
+ write_element(root, i);
}
}