[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master b34add4 1/5: Add an equality operator
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master b34add4 1/5: Add an equality operator |
Date: |
Tue, 27 Apr 2021 13:59:01 -0400 (EDT) |
branch: master
commit b34add4adead8acae369d57f816e1a6ecc4f011e
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Add an equality operator
It is anticipated that all but one line of this change will be expunged
soon enough.
Unfortunately the shorthand
default: ==, !=, <, >, <=, >=;
proposed in
http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2014/n4126.htm
has not been embraced by C++20.
SD-6 says: "in most cases it is expected that the presence of a feature
can be determined by the presence of any non-zero macro value".
---
gpt_commutation_functions.hpp | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/gpt_commutation_functions.hpp b/gpt_commutation_functions.hpp
index 54dc460..7d824fa 100644
--- a/gpt_commutation_functions.hpp
+++ b/gpt_commutation_functions.hpp
@@ -113,6 +113,35 @@ struct gpt_scalar_parms
double qab_spouse_amt { 0.0};
double qab_child_amt { 0.0};
double qab_waiver_amt { 0.0};
+
+#if defined __cpp_impl_three_way_comparison && __cpp_impl_three_way_comparison
+ bool operator==(gpt_scalar_parms const&) const = default;
+#else // no operator<=>
+ bool operator==(gpt_scalar_parms const& z) const
+ {
+ return
+ z.duration == duration
+ && z.f3_bft == f3_bft
+ && z.endt_bft == endt_bft
+ && z.target_prem == target_prem
+ && z.chg_sa_base == chg_sa_base
+ && z.defn_life_ins == defn_life_ins
+ && z.dbopt_7702 == dbopt_7702
+ && z.gross_1035 == gross_1035
+ && z.is_inforce == is_inforce
+ && z.inforce_glp == inforce_glp
+ && z.inforce_cum_glp == inforce_cum_glp
+ && z.inforce_gsp == inforce_gsp
+ && z.inforce_cum_pmt == inforce_cum_pmt
+ && z.qab_gio_amt == qab_gio_amt
+ && z.qab_adb_amt == qab_adb_amt
+ && z.qab_term_amt == qab_term_amt
+ && z.qab_spouse_amt == qab_spouse_amt
+ && z.qab_child_amt == qab_child_amt
+ && z.qab_waiver_amt == qab_waiver_amt
+ ;
+ }
+#endif // no operator<=>
};
/// Commutation functions specialized for GPT calculations.