lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 5e45c3d: Improve const correctness


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 5e45c3d: Improve const correctness
Date: Thu, 27 Sep 2018 20:12:35 -0400 (EDT)

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

    Improve const correctness
    
    Rewrote, instead of just inserting 'const', in order to avoid violating
    an 80-column limit yet again.
---
 ledger_evaluator.cpp | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/ledger_evaluator.cpp b/ledger_evaluator.cpp
index 8c5a0e4..a34aae9 100644
--- a/ledger_evaluator.cpp
+++ b/ledger_evaluator.cpp
@@ -1023,12 +1023,10 @@ ledger_evaluator Ledger::make_evaluator() const
         // show columns alphabetically. Other, more complicated
         // techniques are faster, but direct copying favors simplicity
         // over speed--appropriately, as this facility is rarely used.
-        std::map<std::string,std::vector<std::string>> ordered_stringvectors
-            (stringvectors.begin()
-            ,stringvectors.end()
-            );
+        using map_t = std::map<std::string,std::vector<std::string>> const;
+        map_t sorted_stringvectors(stringvectors.begin(), stringvectors.end());
 
-        for(auto const& j : ordered_stringvectors)
+        for(auto const& j : sorted_stringvectors)
             {
             ofs << j.first << '\t';
             }
@@ -1036,7 +1034,7 @@ ledger_evaluator Ledger::make_evaluator() const
 
         for(int i = 0; i < GetMaxLength(); ++i)
             {
-            for(auto const& j : ordered_stringvectors)
+            for(auto const& j : sorted_stringvectors)
                 {
                 std::vector<std::string> const& v = j.second;
                 if(i < lmi::ssize(v))



reply via email to

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