lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 9856493 2/2: Modernize for statements


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 9856493 2/2: Modernize for statements
Date: Wed, 18 Jan 2017 22:40:51 +0000 (UTC)

branch: master
commit 985649354bcc461a073fd664d77b23f1c567c96f
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Modernize for statements
---
 authenticity.cpp |    4 ++--
 gpt_state.cpp    |    5 ++---
 mec_state.cpp    |    5 ++---
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/authenticity.cpp b/authenticity.cpp
index 6af72fd..7d49bc0 100644
--- a/authenticity.cpp
+++ b/authenticity.cpp
@@ -292,12 +292,12 @@ std::string md5_hex_string(std::vector<unsigned char> 
const& vuc)
     LMI_ASSERT(md5len == vuc.size());
     std::stringstream oss;
     oss << std::hex;
-    for(int j = 0; j < md5len; ++j)
+    for(auto const& j : vuc)
         {
         oss
             << std::setw(chars_per_formatted_hex_byte)
             << std::setfill('0')
-            << static_cast<unsigned int>(vuc[j])
+            << static_cast<unsigned int>(j)
             ;
         }
     return oss.str();
diff --git a/gpt_state.cpp b/gpt_state.cpp
index e2f405d..e22e9f1 100644
--- a/gpt_state.cpp
+++ b/gpt_state.cpp
@@ -43,10 +43,9 @@ template class xml_serializable<gpt_state>;
 gpt_state::gpt_state()
 {
     AscribeMembers();
-    std::vector<std::string>::const_iterator i;
-    for(i = member_names().begin(); i != member_names().end(); ++i)
+    for(auto const& i : member_names())
         {
-        operator[](*i) = "0";
+        operator[](i) = "0";
         }
 }
 
diff --git a/mec_state.cpp b/mec_state.cpp
index aa30841..7c06b66 100644
--- a/mec_state.cpp
+++ b/mec_state.cpp
@@ -43,10 +43,9 @@ template class xml_serializable<mec_state>;
 mec_state::mec_state()
 {
     AscribeMembers();
-    std::vector<std::string>::const_iterator i;
-    for(i = member_names().begin(); i != member_names().end(); ++i)
+    for(auto const& i : member_names())
         {
-        operator[](*i) = "0";
+        operator[](i) = "0";
         }
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]