lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master c90e25a 11/11: No longer invoke std::operator


From: Greg Chicares
Subject: [lmi-commits] [lmi] master c90e25a 11/11: No longer invoke std::operator==() explicitly for vectors
Date: Tue, 16 Feb 2021 13:06:23 -0500 (EST)

branch: master
commit c90e25a83e2ab67be1311d6b8ac895861c31d8f2
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    No longer invoke std::operator==() explicitly for vectors
    
    Root cause fixed in PETE.
---
 dbvalue.cpp                    |  9 ---------
 expression_template_0_test.cpp |  6 +++---
 interest_rates.cpp             | 15 ++++-----------
 loads.cpp                      | 36 ++++++++++++++++++------------------
 4 files changed, 25 insertions(+), 41 deletions(-)

diff --git a/dbvalue.cpp b/dbvalue.cpp
index 9dcce1f..dd8117c 100644
--- a/dbvalue.cpp
+++ b/dbvalue.cpp
@@ -157,21 +157,12 @@ database_entity& 
database_entity::operator=(database_entity const& z)
 
 bool database_entity::operator==(database_entity const& z) const
 {
-#if 0
-// PETE causes an 'ambiguous overload' error for vector 'v0==v1'.
     return
            key_          == z.key_
         && axis_lengths_ == z.axis_lengths_
         && data_values_  == z.data_values_
         && gloss_        == z.gloss_
         ;
-#endif // 0
-    return
-           key_          == z.key_
-        && std::operator==(axis_lengths_, z.axis_lengths_)
-        && std::operator==(data_values_ , z.data_values_ )
-        && gloss_        == z.gloss_
-        ;
 }
 
 /// Change dimensions.
diff --git a/expression_template_0_test.cpp b/expression_template_0_test.cpp
index 5b1292e..c40c182 100644
--- a/expression_template_0_test.cpp
+++ b/expression_template_0_test.cpp
@@ -493,11 +493,11 @@ void test_pete_assignment()
 // With the operator<<() above, this:
     std::vector<double> v7a(v0.size());
     assign(v7a, v0 - v1);
-    BOOST_TEST(std::operator==(v2, v7a));
+    BOOST_TEST(v2 == v7a);
 // could be written thus:
     std::vector<double> v7b(v0.size());
     v7b << v0 - v1;
-    BOOST_TEST(std::operator==(v2, v7b));
+    BOOST_TEST(v2 == v7b);
 // though these still wouldn't compile:
 //  std::vector<double> v7c << v0 - v1;
 //  std::vector<double> v7d(v0 - v1);
@@ -510,7 +510,7 @@ void test_pete_assignment()
 // silly to add zero to everything.
     std::vector<double> v7f(v0.size());
     v7f += v0 - v1;
-    BOOST_TEST(std::operator==(v2, v7f));
+    BOOST_TEST(v2 == v7f);
 // But that may be the best that can easily be done with PETE: where
 //  std::vector<double> v7f += v0 - v1;
 // is wanted, instead write
diff --git a/interest_rates.cpp b/interest_rates.cpp
index 6810fc3..0a96535 100644
--- a/interest_rates.cpp
+++ b/interest_rates.cpp
@@ -677,21 +677,14 @@ void InterestRates::InitializeLoanRates()
     // RegLnDueRate_ cannot vary by basis for fixed loan rate, but
     // may for VLR--in which case these assertions will fire,
     // indicating that this code should be reviewed.
-    //
-    // PETE causes an 'ambiguous overload' error for vector 'v0==v1',
-    // but not if std::operator==(v0,v1) is called explicitly.
 
     LMI_ASSERT
-        (std::operator==
-            (RegLnDueRate_[mce_annual_rate ][mce_gen_guar]
-            ,RegLnDueRate_[mce_annual_rate ][mce_gen_curr]
-            )
+        (  RegLnDueRate_[mce_annual_rate ][mce_gen_guar]
+        == RegLnDueRate_[mce_annual_rate ][mce_gen_curr]
         );
     LMI_ASSERT
-        (std::operator==
-            (RegLnDueRate_[mce_monthly_rate][mce_gen_guar]
-            ,RegLnDueRate_[mce_monthly_rate][mce_gen_curr]
-            )
+        (  RegLnDueRate_[mce_monthly_rate][mce_gen_guar]
+        == RegLnDueRate_[mce_monthly_rate][mce_gen_curr]
         );
 }
 
diff --git a/loads.cpp b/loads.cpp
index 236ecf6..022b2df 100644
--- a/loads.cpp
+++ b/loads.cpp
@@ -159,22 +159,22 @@ void Loads::Initialize(product_database const& database, 
load_details const& det
     database.query_into(DB_CurrPremLoadExcRfd, excess_sales_load_    
[mce_gen_curr]);
 
     // Make sure database contents have no excess precision.
-    LMI_ASSERT(std::operator==
+    LMI_ASSERT
         (r.c(monthly_policy_fee_   [mce_gen_guar])
-        ,    monthly_policy_fee_   [mce_gen_guar]
-        ));
-    LMI_ASSERT(std::operator==
+        ==   monthly_policy_fee_   [mce_gen_guar]
+        );
+    LMI_ASSERT
         (r.c(annual_policy_fee_    [mce_gen_guar])
-        ,    annual_policy_fee_    [mce_gen_guar]
-        ));
-    LMI_ASSERT(std::operator==
+        ==   annual_policy_fee_    [mce_gen_guar]
+        );
+    LMI_ASSERT
         (r.c(monthly_policy_fee_   [mce_gen_curr])
-        ,    monthly_policy_fee_   [mce_gen_curr]
-        ));
-    LMI_ASSERT(std::operator==
+        ==   monthly_policy_fee_   [mce_gen_curr]
+        );
+    LMI_ASSERT
         (r.c(annual_policy_fee_    [mce_gen_curr])
-        ,    annual_policy_fee_    [mce_gen_curr]
-        ));
+        ==   annual_policy_fee_    [mce_gen_curr]
+        );
 }
 
 /// Transform raw input and database data into directly-useful rates.
@@ -398,14 +398,14 @@ Loads::Loads(product_database const& database, bool 
NeedMidpointRates)
     database.query_into(DB_CurrSpecAmtLoad   , 
specified_amount_load_[mce_gen_curr]);
 
     // Make sure database contents have no excess precision.
-    LMI_ASSERT(std::operator==
+    LMI_ASSERT
         (r.c(monthly_policy_fee_   [mce_gen_guar])
-        ,    monthly_policy_fee_   [mce_gen_guar]
-        ));
-    LMI_ASSERT(std::operator==
+        ==   monthly_policy_fee_   [mce_gen_guar]
+        );
+    LMI_ASSERT
         (r.c(monthly_policy_fee_   [mce_gen_curr])
-        ,    monthly_policy_fee_   [mce_gen_curr]
-        ));
+        ==   monthly_policy_fee_   [mce_gen_curr]
+        );
 
     // This ctor ignores tabular specified-amount loads.
 



reply via email to

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