[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 4d37337 2/2: Pass container (not iterators) t
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 4d37337 2/2: Pass container (not iterators) to each_equal() wherever possible |
Date: |
Sun, 22 Jan 2017 11:48:23 +0000 (UTC) |
branch: master
commit 4d3733791b9d200574fac90cff20582fe7e7cc31
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Pass container (not iterators) to each_equal() wherever possible
---
gpt_input.cpp | 6 +++---
gpt_server.cpp | 4 ++--
input_realization.cpp | 8 ++++----
interest_rates.cpp | 4 ++--
ledger_invariant.cpp | 10 ++--------
ledger_xml_io.cpp | 6 +-----
mec_input.cpp | 4 ++--
mec_server.cpp | 4 ++--
yare_input.cpp | 2 +-
9 files changed, 19 insertions(+), 29 deletions(-)
diff --git a/gpt_input.cpp b/gpt_input.cpp
index a345d32..7e80a03 100644
--- a/gpt_input.cpp
+++ b/gpt_input.cpp
@@ -33,7 +33,7 @@
#include "global_settings.hpp"
#include "input_seq_helpers.hpp" // convert_vector(),
convert_vector_type()
#include "map_lookup.hpp"
-#include "miscellany.hpp" // lmi_array_size()
+#include "miscellany.hpp" // each_equal(), lmi_array_size()
#include <algorithm> // std::max()
#include <limits>
@@ -618,7 +618,7 @@ std::string gpt_input::RealizeOldFlatExtra()
return "";
}
- if(!each_equal(OldFlatExtraRealized_.begin(), OldFlatExtraRealized_.end(),
0.0))
+ if(!each_equal(OldFlatExtraRealized_, 0.0))
{
return "Flat extras may not be illustrated on this policy form.";
}
@@ -645,7 +645,7 @@ std::string gpt_input::RealizeNewFlatExtra()
return "";
}
- if(!each_equal(NewFlatExtraRealized_.begin(), NewFlatExtraRealized_.end(),
0.0))
+ if(!each_equal(NewFlatExtraRealized_, 0.0))
{
return "Flat extras may not be illustrated on this policy form.";
}
diff --git a/gpt_server.cpp b/gpt_server.cpp
index c2da9ed..8e3156b 100644
--- a/gpt_server.cpp
+++ b/gpt_server.cpp
@@ -40,7 +40,7 @@
#include "materially_equal.hpp" // material_difference()
#include "math_functors.hpp"
#include "mc_enum_types_aux.hpp" // mc_state_from_string()
-#include "miscellany.hpp" // ios_out_trunc_binary()
+#include "miscellany.hpp" // each_equal(), ios_out_trunc_binary()
#include "oecumenic_enumerations.hpp"
#include "path_utility.hpp" // unique_filepath(), fs::path inserter
#include "premium_tax.hpp"
@@ -218,7 +218,7 @@ gpt_state test_one_days_gpt_transactions
// the normal operator==(). Is that a PETE defect?
std::vector<double> const zero(input.years_to_maturity(), 0.0);
std::vector<double> const& naar_disc_rate =
- each_equal(Mly7702ig.begin(), Mly7702ig.end(), 0.0)
+ each_equal(Mly7702ig, 0.0)
? zero
: Mly7702iGlp
;
diff --git a/input_realization.cpp b/input_realization.cpp
index 5291465..c39437b 100644
--- a/input_realization.cpp
+++ b/input_realization.cpp
@@ -31,7 +31,7 @@
#include "global_settings.hpp"
#include "handle_exceptions.hpp"
#include "input_seq_helpers.hpp"
-#include "miscellany.hpp" // minmax
+#include "miscellany.hpp" // each_equal(), minmax
#include "round_to.hpp"
#include "value_cast.hpp"
@@ -794,7 +794,7 @@ std::string Input::RealizeNewLoan()
return "";
}
- if(!each_equal(NewLoanRealized_.begin(), NewLoanRealized_.end(), 0.0))
+ if(!each_equal(NewLoanRealized_, 0.0))
{
return "Loans may not be illustrated on this policy form.";
}
@@ -817,7 +817,7 @@ std::string Input::RealizeWithdrawal()
if(!database_->Query(DB_AllowWd))
{
- if(!each_equal(WithdrawalRealized_.begin(), WithdrawalRealized_.end(),
0.0))
+ if(!each_equal(WithdrawalRealized_, 0.0))
{
return "Withdrawals may not be illustrated on this policy form.";
}
@@ -865,7 +865,7 @@ std::string Input::RealizeFlatExtra()
return "";
}
- if(!each_equal(FlatExtraRealized_.begin(), FlatExtraRealized_.end(), 0.0))
+ if(!each_equal(FlatExtraRealized_, 0.0))
{
return "Flat extras not permitted.";
}
diff --git a/interest_rates.cpp b/interest_rates.cpp
index 6341bd5..f533cc3 100644
--- a/interest_rates.cpp
+++ b/interest_rates.cpp
@@ -242,7 +242,7 @@ bool need_loan_rates(yare_input const& yi)
|| 0.0 != yi.InforcePreferredLoanValue
|| 0.0 != yi.InforceRegularLoanBalance
|| 0.0 != yi.InforcePreferredLoanBalance
- || !each_equal(yi.NewLoan.begin(), yi.NewLoan.end(), 0.0)
+ || !each_equal(yi.NewLoan, 0.0)
;
}
#endif // 0
@@ -640,7 +640,7 @@ void InterestRates::InitializeLoanRates()
// arise:
LMI_ASSERT
( mce_fixed_loan_rate == LoanRateType_
- || each_equal(PrefLoanRateDecr_.begin(), PrefLoanRateDecr_.end(), 0.0)
+ || each_equal(PrefLoanRateDecr_, 0.0)
);
for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
{
diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
index 876fed6..e5169c3 100644
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -500,7 +500,7 @@ void LedgerInvariant::Init(BasicValues const* b)
else if(b->Database_->Query(DB_TermIsNotRider))
{
TermSpecAmt = b->DeathBfts_->supplamt();
- if(!each_equal(TermSpecAmt.begin(), TermSpecAmt.end(), 0.0))
+ if(!each_equal(TermSpecAmt, 0.0))
{
HasSupplSpecAmt = true;
}
@@ -631,13 +631,7 @@ void LedgerInvariant::Init(BasicValues const* b)
std::vector<double> const& guar_m_and_e_rate = b->InterestRates_->MAndERate
(mce_gen_guar
);
- LMI_ASSERT
- (each_equal
- (guar_m_and_e_rate.begin()
- ,guar_m_and_e_rate.end()
- ,guar_m_and_e_rate.front()
- )
- );
+ LMI_ASSERT(each_equal(guar_m_and_e_rate, guar_m_and_e_rate.front()));
GuarMaxMandE = guar_m_and_e_rate[0];
InitDacTaxRate =
b->Loads_->dac_tax_load()[b->yare_input_.InforceYear];
InitPremTaxRate = b->PremiumTax_->maximum_load_rate();
diff --git a/ledger_xml_io.cpp b/ledger_xml_io.cpp
index 498447b..8dcb609 100644
--- a/ledger_xml_io.cpp
+++ b/ledger_xml_io.cpp
@@ -684,11 +684,7 @@ void Ledger::write(xml::element& x) const
strings["PrepDay" ] = &PrepDay;
double SalesLoadRefund =
- !each_equal
- (ledger_invariant_->RefundableSalesLoad.begin()
- ,ledger_invariant_->RefundableSalesLoad.end()
- ,0.0
- );
+ !each_equal(ledger_invariant_->RefundableSalesLoad, 0.0);
double SalesLoadRefundRate0 = ledger_invariant_->RefundableSalesLoad[0];
double SalesLoadRefundRate1 = ledger_invariant_->RefundableSalesLoad[1];
diff --git a/mec_input.cpp b/mec_input.cpp
index 0458184..8f5107d 100644
--- a/mec_input.cpp
+++ b/mec_input.cpp
@@ -33,7 +33,7 @@
#include "global_settings.hpp"
#include "input_seq_helpers.hpp" // convert_vector(),
convert_vector_type()
#include "map_lookup.hpp"
-#include "miscellany.hpp" // lmi_array_size()
+#include "miscellany.hpp" // each_equal(), lmi_array_size()
#include <algorithm> // std::max()
#include <limits>
@@ -564,7 +564,7 @@ std::string mec_input::RealizeFlatExtra()
return "";
}
- if(!each_equal(FlatExtraRealized_.begin(), FlatExtraRealized_.end(), 0.0))
+ if(!each_equal(FlatExtraRealized_, 0.0))
{
return "Flat extras may not be illustrated on this policy form.";
}
diff --git a/mec_server.cpp b/mec_server.cpp
index 3923266..28668f9 100644
--- a/mec_server.cpp
+++ b/mec_server.cpp
@@ -39,7 +39,7 @@
#include "mc_enum_types_aux.hpp" // mc_state_from_string()
#include "mec_input.hpp"
#include "mec_xml_document.hpp"
-#include "miscellany.hpp" // ios_out_trunc_binary()
+#include "miscellany.hpp" // each_equal(), ios_out_trunc_binary()
#include "oecumenic_enumerations.hpp"
#include "path_utility.hpp" // unique_filepath(), fs::path inserter
#include "premium_tax.hpp"
@@ -201,7 +201,7 @@ mec_state test_one_days_7702A_transactions
// the normal operator==(). Is that a PETE defect?
std::vector<double> const zero(input.years_to_maturity(), 0.0);
std::vector<double> const& naar_disc_rate =
- each_equal(Mly7702ig.begin(), Mly7702ig.end(), 0.0)
+ each_equal(Mly7702ig, 0.0)
? zero
: Mly7702iGlp
;
diff --git a/yare_input.cpp b/yare_input.cpp
index 00e1371..f4a33d1 100644
--- a/yare_input.cpp
+++ b/yare_input.cpp
@@ -208,7 +208,7 @@ bool is_policy_rated(yare_input const& z)
{
return
mce_table_none != z.SubstandardTable
- || !each_equal(z.FlatExtra.begin(), z.FlatExtra.end(), 0.0)
+ || !each_equal(z.FlatExtra, 0.0)
;
}