lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master cdfcd2d 3/5: Refactor, trivially


From: Greg Chicares
Subject: [lmi-commits] [lmi] master cdfcd2d 3/5: Refactor, trivially
Date: Wed, 25 Jan 2017 01:45:53 +0000 (UTC)

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

    Refactor, trivially
---
 ihs_irc7702.cpp      |    3 +--
 ledger_base.cpp      |    7 ++++---
 miscellany.hpp       |    5 +----
 xml_serializable.tpp |    3 +--
 4 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/ihs_irc7702.cpp b/ihs_irc7702.cpp
index ac228cc..9d6d012 100644
--- a/ihs_irc7702.cpp
+++ b/ihs_irc7702.cpp
@@ -490,13 +490,12 @@ void Irc7702::InitCorridor()
         );
 
     // GPT corridor
-    std::vector<double>::const_iterator corr = CompleteGptCorridor().begin();
     LMI_ASSERT
         (   static_cast<unsigned int>(IssueAge)
         <=  CompleteGptCorridor().size()
         );
     GptCorridor.assign
-        (corr + IssueAge
+        (CompleteGptCorridor().begin() + IssueAge
         ,CompleteGptCorridor().end()
         );
 }
diff --git a/ledger_base.cpp b/ledger_base.cpp
index 85dde59..99f756d 100644
--- a/ledger_base.cpp
+++ b/ledger_base.cpp
@@ -262,9 +262,10 @@ LedgerBase& LedgerBase::PlusEq
         }
     LMI_ASSERT(a_Addend_svmi == a_Addend.BegYearVectors.end());
 
-    std::vector<double>::const_iterator eyi = a_Inforce.begin();
-    eyi++;
-    std::vector<double> const EndYearInforce(eyi, a_Inforce.end());
+    std::vector<double> const EndYearInforce
+        (a_Inforce.begin() + 1
+        ,a_Inforce.end()
+        );
     a_Addend_svmi = a_Addend.EndYearVectors.begin();
     for
         (double_vector_map::iterator svmi = EndYearVectors.begin()
diff --git a/miscellany.hpp b/miscellany.hpp
index 370a2c0..8a630c7 100644
--- a/miscellany.hpp
+++ b/miscellany.hpp
@@ -74,13 +74,10 @@ bool files_are_identical(std::string const&, std::string 
const&);
 template<typename T>
 class minmax
 {
-    typedef typename std::vector<T>::const_iterator extremum_t;
-    typedef std::pair<extremum_t,extremum_t> extrema_t;
-
   public:
     explicit minmax(std::vector<T> const& v)
         {
-        extrema_t extrema = std::minmax_element(v.begin(), v.end());
+        auto const& extrema = std::minmax_element(v.begin(), v.end());
         minimum_ = *extrema.first ;
         maximum_ = *extrema.second;
         }
diff --git a/xml_serializable.tpp b/xml_serializable.tpp
index d8a62d0..3b50a9a 100644
--- a/xml_serializable.tpp
+++ b/xml_serializable.tpp
@@ -105,12 +105,11 @@ void xml_serializable<T>::read(xml::element const& x)
         ,t().member_names().end()
         ,std::back_inserter(residuary_names)
         );
-    std::list<std::string>::iterator current_member;
 
     for(auto const& child : x.elements())
         {
         std::string node_tag(child.get_name());
-        current_member = std::find
+        std::list<std::string>::iterator current_member = std::find
             (residuary_names.begin()
             ,residuary_names.end()
             ,node_tag



reply via email to

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