lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 4d87259 3/6: Create and use a proper alias


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 4d87259 3/6: Create and use a proper alias
Date: Fri, 19 Oct 2018 15:45:06 -0400 (EDT)

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

    Create and use a proper alias
    
    See the preceding commit message. After
          smart_pointer p(values);
          p->do_something();
          container.push_back(p);
    it was improper to continue using p as an alias for container.back(),
    even though that happened to work for std::shared_ptr.
---
 group_values.cpp | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/group_values.cpp b/group_values.cpp
index 2e44cff..d7014f7 100644
--- a/group_values.cpp
+++ b/group_values.cpp
@@ -267,24 +267,25 @@ census_run_result run_census_in_parallel::operator()
             {
             { // Begin fenv_guard scope.
             fenv_guard fg;
-            std::shared_ptr<AccountValue> av(new AccountValue(ip));
-            cell_values.push_back(av);
+            std::shared_ptr<AccountValue> z(new AccountValue(ip));
+            cell_values.push_back(z);
+            AccountValue& av = *cell_values.back();
 
             std::string const name(cells[j]["InsuredName"].str());
             // Indexing: here, j is an index into cells, not cell_values.
-            av->SetDebugFilename
+            av.SetDebugFilename
                 (serial_file_path(file, name, j, "hastur").string()
                 );
 
-            if(contains(av->yare_input_.Comments, "idiosyncrasyZ"))
+            if(contains(av.yare_input_.Comments, "idiosyncrasyZ"))
                 {
-                av->Debugging = true;
-                av->DebugPrintInit();
+                av.Debugging = true;
+                av.DebugPrintInit();
                 }
 
             if
-                (   first_cell_inforce_year  != av->yare_input_.InforceYear
-                ||  first_cell_inforce_month != av->yare_input_.InforceMonth
+                (   first_cell_inforce_year  != av.yare_input_.InforceYear
+                ||  first_cell_inforce_month != av.yare_input_.InforceMonth
                 )
                 {
                 alarum()
@@ -294,7 +295,7 @@ census_run_result run_census_in_parallel::operator()
                     ;
                 }
 
-            if(mce_solve_none != av->yare_input_.SolveType)
+            if(mce_solve_none != av.yare_input_.SolveType)
                 {
                 alarum()
                     << "Running census by month: solves not permitted."



reply via email to

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