lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master af5a41d 2/9: Demonstrate the nugatoriness of


From: Greg Chicares
Subject: [lmi-commits] [lmi] master af5a41d 2/9: Demonstrate the nugatoriness of composite_lapse_year_
Date: Thu, 4 Oct 2018 19:24:14 -0400 (EDT)

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

    Demonstrate the nugatoriness of composite_lapse_year_
    
    Running a census with various ages, this momentaneous change's assertion
    was observed never to fail; therefore, this data member is confirmed to
    be a bogus optimization that can be dispensed with.
---
 ledger.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ledger.cpp b/ledger.cpp
index 4fc57c9..c7d9db2 100644
--- a/ledger.cpp
+++ b/ledger.cpp
@@ -289,6 +289,14 @@ int Ledger::GetMaxLength() const
 {
     if(is_composite_)
         {
+    ledger_map_t const& l_map_rep = ledger_map_->held();
+    double max_length = 0.0;
+
+    for(auto const& i : l_map_rep)
+        {
+        max_length = std::max(max_length, i.second.LapseYear);
+        }
+    LMI_ASSERT(max_length == composite_lapse_year_);
         // TODO ?? The rationale for this special case is not evident.
         // This variable is initialized to zero in the ctor. If it has
         // acquired a value that's actually meaningful, then it looks



reply via email to

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