[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.
- [lmi-commits] [lmi] master updated (3143a30 -> c90e25a), Greg Chicares, 2021/02/16
- [lmi-commits] [lmi] master b321588 05/11: Demonstrate PETE assignment to std::vector, Greg Chicares, 2021/02/16
- [lmi-commits] [lmi] master bcec152 08/11: Amend PETE header and footer for generated files, Greg Chicares, 2021/02/16
- [lmi-commits] [lmi] master 2741732 07/11: Break a makefile dependency cycle, Greg Chicares, 2021/02/16
- [lmi-commits] [lmi] master 2a92707 04/11: Move a comment block that will soon become a test, Greg Chicares, 2021/02/16
- [lmi-commits] [lmi] master 431bdbb 01/11: Do not include PETE in any header except "et_vector.hpp", Greg Chicares, 2021/02/16
- [lmi-commits] [lmi] master acac3ad 03/11: Accommodate 21st-century hardware, Greg Chicares, 2021/02/16
- [lmi-commits] [lmi] master c90e25a 11/11: No longer invoke std::operator==() explicitly for vectors,
Greg Chicares <=
- [lmi-commits] [lmi] master 2844ba0 10/11: Suppress PETE's operator==() for std::vector, Greg Chicares, 2021/02/16
- [lmi-commits] [lmi] master 7f3f834 06/11: Rewrite '*clean*' targets, Greg Chicares, 2021/02/16
- [lmi-commits] [lmi] master 088d2a8 09/11: Regenerate PETE, Greg Chicares, 2021/02/16
- [lmi-commits] [lmi] master 38d5ece 02/11: Further improve physical design, Greg Chicares, 2021/02/16