[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master f9f89bd 3/3: Replace or do without lmi_array_
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master f9f89bd 3/3: Replace or do without lmi_array_size<>() |
Date: |
Sun, 17 Jun 2018 20:08:36 -0400 (EDT) |
branch: master
commit f9f89bd63976563f9e8ba0baf7db307e886100c8
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Replace or do without lmi_array_size<>()
---
commutation_functions_test.cpp | 13 ++++---------
configurable_settings.cpp | 4 +---
contains_test.cpp | 24 +++++++++++++-----------
getopt_test.cpp | 8 ++++----
gpt_input.cpp | 5 ++---
gpt_state.cpp | 5 ++---
ihs_irc7702.cpp | 32 ++++++++++++++++----------------
input_xml_io.cpp | 4 +---
ledger_evaluator.cpp | 5 ++---
ledger_text_formats.cpp | 12 ++----------
ledger_xml_io.cpp | 5 ++---
mec_input.cpp | 5 ++---
mec_state.cpp | 5 ++---
miscellany.hpp | 7 -------
print_matrix_test.cpp | 7 ++-----
product_data.cpp | 4 +---
stratified_algorithms_test.cpp | 25 ++++++++-----------------
xml_serializable.tpp | 3 +--
xml_serialize_test.cpp | 8 ++------
19 files changed, 67 insertions(+), 114 deletions(-)
diff --git a/commutation_functions_test.cpp b/commutation_functions_test.cpp
index f0424fd..362f65c 100644
--- a/commutation_functions_test.cpp
+++ b/commutation_functions_test.cpp
@@ -25,7 +25,6 @@
#include "et_vector.hpp"
#include "math_functions.hpp"
-#include "miscellany.hpp" // lmi_array_size()
#include "ssize_lmi.hpp"
#include "test_tools.hpp"
#include "timer.hpp"
@@ -146,7 +145,7 @@ void TestEckleyTable2()
, 813.15, 836.91, 860.33, 888.39, 930.30, 1000.00
};
- static double const COI[65] =
+ std::vector<double>coi
{ 0.00200, 0.00206, 0.00214, 0.00224, 0.00236, 0.00250,
0.00265, 0.00282, 0.00301, 0.00324
, 0.00350, 0.00382, 0.00419, 0.00460, 0.00504, 0.00550,
0.00596, 0.00645, 0.00697, 0.00756
, 0.00825, 0.00903, 0.00990, 0.01088, 0.01199, 0.01325,
0.01469, 0.01631, 0.01811, 0.02009
@@ -156,7 +155,6 @@ void TestEckleyTable2()
, 0.40000, 0.50000, 0.60000, 0.70000, 1.00000
};
- std::vector<double>coi (COI, COI + lmi_array_size(COI));
std::vector<double>ic (coi.size(), 0.10);
std::vector<double>ig (coi.size(), 0.04);
@@ -278,14 +276,13 @@ void TestEckleyTables3and4()
};
// Eckley's final COI rate is superfluous.
- static double const COI[30] =
+ std::vector<double>coi
{ 0.00200, 0.00206, 0.00214, 0.00224, 0.00236, 0.00250,
0.00265, 0.00282, 0.00301, 0.00324
, 0.00350, 0.00382, 0.00419, 0.00460, 0.00504, 0.00550,
0.00596, 0.00645, 0.00697, 0.00756
, 0.00825, 0.00903, 0.00990, 0.01088, 0.01199, 0.01325,
0.01469, 0.01631, 0.01811, 0.02009
,/*0.02225 */
};
- std::vector<double>coi (COI, COI + lmi_array_size(COI));
std::vector<double>ic (coi.size(), 0.10);
std::vector<double>ig (coi.size(), 0.04);
@@ -369,14 +366,13 @@ void TestEckleyTable5()
,0.000066
};
- static double const COI[31] =
+ std::vector<double>coi
{0.00018, 0.00007, 0.00007, 0.00006, 0.00006, 0.00006, 0.00006,
0.00005, 0.00005, 0.00005
,0.00005, 0.00005, 0.00006, 0.00007, 0.00008, 0.00009, 0.00010,
0.00010, 0.00011, 0.00011
,0.00011, 0.00011, 0.00011, 0.00011, 0.00010, 0.00010, 0.00010,
0.00010, 0.00010, 0.00010
,0.00010
};
- std::vector<double>coi (COI, COI + lmi_array_size(COI));
std::vector<double>ic (coi.size(),
i_upper_12_over_12_from_i<double>()(0.10));
std::vector<double>ig (coi.size(),
i_upper_12_over_12_from_i<double>()(0.04));
@@ -458,7 +454,7 @@ void ULCommFnsTest()
void Test_1954_1958_IET_3pct()
{
- static double const lx[100] =
+ std::vector<double> ell_ex
{ 1000000, 994890, 993477, 992583, 991839,
991214, 990679, 990213, 989797, 989411
, 989035, 988639, 988204, 987720, 987177,
986555, 985855, 985076, 984219, 983294
, 982311, 981280, 980210, 979122, 978025,
976920, 975797, 974655, 973485, 972278
@@ -521,7 +517,6 @@ void Test_1954_1958_IET_3pct()
, 3773.3235, 2896.4084, 2181.9813, 1608.8948, 1147.0221,
771.0449, 468.4483, 239.5823, 90.2163, 17.6305
};
- std::vector<double> ell_ex(lx, lx + lmi_array_size(lx));
std::vector<double> E_ell_ex(ell_ex);
E_ell_ex.erase(E_ell_ex.begin());
E_ell_ex.push_back(0.0);
diff --git a/configurable_settings.cpp b/configurable_settings.cpp
index 99ba440..42a5327 100644
--- a/configurable_settings.cpp
+++ b/configurable_settings.cpp
@@ -31,7 +31,6 @@
#include "map_lookup.hpp"
#include "mc_enum.hpp" // all_strings<>()
#include "mc_enum_type_enums.hpp" // mcenum_report_column
-#include "miscellany.hpp" // lmi_array_size()
#include "path_utility.hpp" // validate_directory(),
validate_filepath()
#include "platform_dependent.hpp" // access()
@@ -244,7 +243,7 @@ void
configurable_settings::handle_missing_version_attribute() const
bool configurable_settings::is_detritus(std::string const& s) const
{
- static std::string const a[] =
+ static std::vector<std::string> const v
{"custom_input_filename" // Renamed to
'custom_input_0_filename'.
,"custom_output_filename" // Renamed to
'custom_output_0_filename'.
,"xml_schema_filename" // Withdrawn.
@@ -254,7 +253,6 @@ bool configurable_settings::is_detritus(std::string const&
s) const
,"xslt_light_tab_delimited_filename" // Withdrawn.
,"xslt_tab_delimited_filename" // Withdrawn.
};
- static std::vector<std::string> const v(a, a + lmi_array_size(a));
return contains(v, s);
}
diff --git a/contains_test.cpp b/contains_test.cpp
index 8ff216b..42a2e20 100644
--- a/contains_test.cpp
+++ b/contains_test.cpp
@@ -23,7 +23,6 @@
#include "contains.hpp"
-#include "miscellany.hpp" // lmi_array_size()
#include "test_tools.hpp"
#include <deque>
@@ -58,11 +57,6 @@ void test_contains()
{
std::string const w("etaoin shrdlu");
std::string const x("lorem ipsum");
- std::string const y[] = {"O Sibili", "si ergo", "fortibus es", "in ero"};
- std::pair<std::string,std::string> const z[] =
- {std::pair<std::string,std::string>("O Nobili", "demis trux")
- ,std::pair<std::string,std::string>("uatis inem", "causendux")
- };
// Strings.
@@ -75,14 +69,22 @@ void test_contains()
// Associative containers.
- std::map<std::string,std::string> const m(z, z + lmi_array_size(z));
- BOOST_TEST( contains(m, "uatis inem" ));
- BOOST_TEST(!contains(m, "cows and ducks"));
-
- std::set<std::string> const s(y, y + lmi_array_size(y));
+ std::set<std::string> const s
+ {"O Sibili"
+ ,"si ergo"
+ ,"fortibus es"
+ ,"in ero"
+ };
BOOST_TEST( contains(s, "si ergo" ));
BOOST_TEST(!contains(s, "fortibus"));
+ std::map<std::string,std::string> const m
+ {{"O Nobili", "demis trux"}
+ ,{"uatis inem", "causendux"}
+ };
+ BOOST_TEST( contains(m, "uatis inem" ));
+ BOOST_TEST(!contains(m, "cows and ducks"));
+
// Sequences.
std::deque<double> const d(1, 3.14);
diff --git a/getopt_test.cpp b/getopt_test.cpp
index 36332ca..0251388 100644
--- a/getopt_test.cpp
+++ b/getopt_test.cpp
@@ -44,7 +44,7 @@
#include "getopt.hpp"
#include "assert_lmi.hpp"
-#include "miscellany.hpp" // lmi_array_size()
+#include "ssize_lmi.hpp"
#include "test_tools.hpp"
#include <sstream>
@@ -204,14 +204,14 @@ int test_main(int, char*[])
char arg1[] = {"--verbose"};
char arg2[] = {"xyz"};
char* test_argv[] = {arg0, arg1, arg2, nullptr};
- int test_argc = -1 + static_cast<int>(lmi_array_size(test_argv));
+ int test_argc = -1 + lmi::ssize(test_argv);
std::string s = getopt_test::test(test_argc, test_argv);
BOOST_TEST_EQUAL(s, "option verbose\nnon-option ARGV-elements: xyz\n");
}
{
char* test_argv[] = {nullptr};
- int test_argc = -1 + static_cast<int>(lmi_array_size(test_argv));
+ int test_argc = -1 + lmi::ssize(test_argv);
std::string s = getopt_test::test(test_argc, test_argv);
BOOST_TEST_EQUAL(s, "");
}
@@ -221,7 +221,7 @@ int test_main(int, char*[])
char arg1[] = {"-o"};
char arg2[] = {"-d1,2,3"};
char* test_argv[] = {arg0, arg1, arg2, nullptr};
- int test_argc = -1 + static_cast<int>(lmi_array_size(test_argv));
+ int test_argc = -1 + lmi::ssize(test_argv);
std::string s = getopt_test::test(test_argc, test_argv);
BOOST_TEST_EQUAL(s, "option o\noption d with value '1,2,3'\n");
}
diff --git a/gpt_input.cpp b/gpt_input.cpp
index 97a892a..815d08e 100644
--- a/gpt_input.cpp
+++ b/gpt_input.cpp
@@ -33,7 +33,7 @@
#include "global_settings.hpp"
#include "input_sequence_aux.hpp" // convert_vector(),
convert_vector_type()
#include "map_lookup.hpp"
-#include "miscellany.hpp" // each_equal(), lmi_array_size()
+#include "miscellany.hpp" // each_equal()
#include <algorithm> // max()
#include <exception>
@@ -701,10 +701,9 @@ std::string const& gpt_input::xml_root_name() const
bool gpt_input::is_detritus(std::string const& s) const
{
- static std::string const a[] =
+ static std::vector<std::string> const v
{"Remove this string when adding the first removed entity."
};
- static std::vector<std::string> const v(a, a + lmi_array_size(a));
return contains(v, s);
}
diff --git a/gpt_state.cpp b/gpt_state.cpp
index f49e979..cf0657c 100644
--- a/gpt_state.cpp
+++ b/gpt_state.cpp
@@ -26,7 +26,7 @@
#include "alert.hpp"
#include "contains.hpp"
-#include "miscellany.hpp" // htmlize(), lmi_array_size()
+#include "miscellany.hpp" // htmlize()
#include "value_cast.hpp"
#include "xml_lmi.hpp"
@@ -403,10 +403,9 @@ std::string const& gpt_state::xml_root_name() const
bool gpt_state::is_detritus(std::string const& s) const
{
- static std::string const a[] =
+ static std::vector<std::string> const v
{"Remove this string when adding the first removed entity."
};
- static std::vector<std::string> const v(a, a + lmi_array_size(a));
return contains(v, s);
}
diff --git a/ihs_irc7702.cpp b/ihs_irc7702.cpp
index cfe22c7..0eee5cb 100644
--- a/ihs_irc7702.cpp
+++ b/ihs_irc7702.cpp
@@ -1017,21 +1017,6 @@ double Irc7702::premiums_paid() const
#include <iomanip>
#include <iostream>
-// SOA table 120: "1980 CSO 50% Male Age nearest"
-static double const Q[100] =
-{
- .00354,.00097,.00091,.00089,.00085,.00083,.00079,.00077,.00073,.00072,
- .00071,.00072,.00078,.00087,.00097,.00110,.00121,.00131,.00139,.00144,
- .00148,.00149,.00150,.00149,.00149,.00147,.00147,.00146,.00148,.00151,
- .00154,.00158,.00164,.00170,.00179,.00188,.00200,.00214,.00231,.00251,
- .00272,.00297,.00322,.00349,.00375,.00406,.00436,.00468,.00503,.00541,
- .00583,.00630,.00682,.00742,.00807,.00877,.00950,.01023,.01099,.01181,
- .01271,.01375,.01496,.01639,.01802,.01978,.02164,.02359,.02558,.02773,
- .03016,.03296,.03629,.04020,.04466,.04955,.05480,.06031,.06606,.07223,
- .07907,.08680,.09568,.10581,.11702,.12911,.14191,.15541,.16955,.18445,
- .20023,.21723,.23591,.25743,.28381,.32074,.37793,.47661,.65644,1.0000,
-};
-
int main()
{
// TAXATION !! Update or remove these timings.
@@ -1039,7 +1024,22 @@ int main()
// RW: about 37 msec
// OS: about 93 msec; about 41 if we disable index checking
// in std::vector operator[]()
- std::vector<double>q (Q, Q + lmi_array_size(Q));
+
+// SOA table 120: "1980 CSO 50% Male Age nearest"
+ std::vector<double>q
+ {
+ .00354,.00097,.00091,.00089,.00085,.00083,.00079,.00077,.00073,.00072,
+ .00071,.00072,.00078,.00087,.00097,.00110,.00121,.00131,.00139,.00144,
+ .00148,.00149,.00150,.00149,.00149,.00147,.00147,.00146,.00148,.00151,
+ .00154,.00158,.00164,.00170,.00179,.00188,.00200,.00214,.00231,.00251,
+ .00272,.00297,.00322,.00349,.00375,.00406,.00436,.00468,.00503,.00541,
+ .00583,.00630,.00682,.00742,.00807,.00877,.00950,.01023,.01099,.01181,
+ .01271,.01375,.01496,.01639,.01802,.01978,.02164,.02359,.02558,.02773,
+ .03016,.03296,.03629,.04020,.04466,.04955,.05480,.06031,.06606,.07223,
+ .07907,.08680,.09568,.10581,.11702,.12911,.14191,.15541,.16955,.18445,
+ .20023,.21723,.23591,.25743,.28381,.32074,.37793,.47661,.65644,1.0000,
+ };
+
std::vector<double>i (100, 0.07);
std::vector<double>LoadTgt (100, 0.05);
std::vector<double>MlyChgSpecAmt(100, 0.00);
diff --git a/input_xml_io.cpp b/input_xml_io.cpp
index 1a8fe64..8cbaf16 100644
--- a/input_xml_io.cpp
+++ b/input_xml_io.cpp
@@ -30,7 +30,6 @@
#include "database.hpp"
#include "global_settings.hpp"
#include "map_lookup.hpp"
-#include "miscellany.hpp" // lmi_array_size()
#include "oecumenic_enumerations.hpp"
#include "value_cast.hpp"
@@ -100,7 +99,7 @@ std::string const& Input::xml_root_name() const
bool Input::is_detritus(std::string const& s) const
{
- static std::string const a[] =
+ static std::vector<std::string> const v
{"AgentFirstName" // Single name instead.
,"AgentLastName" // Single name instead.
,"AgentMiddleName" // Single name instead.
@@ -164,7 +163,6 @@ bool Input::is_detritus(std::string const& s) const
,"WithdrawalToDuration" // Withdrawn.
,"YearsOfZeroDeaths" // Withdrawn.
};
- static std::vector<std::string> const v(a, a + lmi_array_size(a));
return contains(v, s);
}
diff --git a/ledger_evaluator.cpp b/ledger_evaluator.cpp
index a80a5f6..fa1e11c 100644
--- a/ledger_evaluator.cpp
+++ b/ledger_evaluator.cpp
@@ -35,7 +35,7 @@
#include "ledger_variant.hpp"
#include "map_lookup.hpp"
#include "mc_enum_aux.hpp" // mc_e_vector_to_string_vector()
-#include "miscellany.hpp" // each_equal(), lmi_array_size()
+#include "miscellany.hpp" // each_equal()
#include "oecumenic_enumerations.hpp"
#include "value_cast.hpp"
#include "version.hpp"
@@ -91,7 +91,7 @@ typedef std::unordered_map<std::string, std::string>
mask_map_t;
bool unavailable(std::string const& s)
{
- static std::string const a[] =
+ static std::vector<std::string> const v
{"DateOfBirthJdn" // used by group quotes
,"EffDateJdn" // used by group quotes
,"ListBillDateJdn" // probably not needed
@@ -102,7 +102,6 @@ bool unavailable(std::string const& s)
,"InitMlyPolFee" // used by PrintRosterTabDelimited()
,"InitTgtPremHiLoadRate" // used by PrintRosterTabDelimited(); not
cents
};
- static std::vector<std::string> const v(a, a + lmi_array_size(a));
return contains(v, s);
}
diff --git a/ledger_text_formats.cpp b/ledger_text_formats.cpp
index ea6a4a0..620ed1c 100644
--- a/ledger_text_formats.cpp
+++ b/ledger_text_formats.cpp
@@ -503,7 +503,7 @@ void PrintCellTabDelimited
os << '\n';
- char const* cheaders[] =
+ std::vector<std::string> const sheaders
{"PolicyYear"
,"AttainedAge"
,"DeathBenefitOption"
@@ -558,10 +558,6 @@ void PrintCellTabDelimited
,"ProducerCompensation"
};
- std::vector<std::string> const sheaders
- (cheaders
- ,cheaders + lmi_array_size(cheaders)
- );
for(auto const& i : sheaders)
{
os << i << '\t';
@@ -686,7 +682,7 @@ void PrintRosterHeaders(std::string const& file_name)
os << "DatePrepared\t\t'" << calendar_date(2000, 1, 1).str() <<
"'\n\n";
}
- char const* cheaders[] =
+ std::vector<std::string> const sheaders
{"Insured1"
,"ContractNumber"
,"DateOfBirth"
@@ -729,10 +725,6 @@ void PrintRosterHeaders(std::string const& file_name)
,"SpouseRiderAmount"
};
- std::vector<std::string> const sheaders
- (cheaders
- ,cheaders + lmi_array_size(cheaders)
- );
for(auto const& i : sheaders)
{
os << i << '\t';
diff --git a/ledger_xml_io.cpp b/ledger_xml_io.cpp
index ec0a14a..1d23978 100644
--- a/ledger_xml_io.cpp
+++ b/ledger_xml_io.cpp
@@ -35,7 +35,7 @@
#include "ledger_variant.hpp"
#include "ledger_xsl.hpp" // xsl_filepath()
#include "mc_enum_aux.hpp" // mc_e_vector_to_string_vector()
-#include "miscellany.hpp" // each_equal(),
ios_out_trunc_binary(), lmi_array_size()
+#include "miscellany.hpp" // each_equal(), ios_out_trunc_binary()
#include "oecumenic_enumerations.hpp"
#include "path_utility.hpp" // fs::path inserter
#include "ssize_lmi.hpp"
@@ -100,7 +100,7 @@ typedef std::map<std::string, std::string> title_map_t;
bool unavailable(std::string const& s)
{
- static std::string const a[] =
+ static std::vector<std::string> const v
{"DateOfBirthJdn" // used by group quotes
,"EffDateJdn" // used by group quotes
,"ListBillDateJdn" // probably not needed
@@ -111,7 +111,6 @@ bool unavailable(std::string const& s)
,"InitMlyPolFee" // used by PrintRosterTabDelimited()
,"InitTgtPremHiLoadRate" // used by PrintRosterTabDelimited(); not
cents
};
- static std::vector<std::string> const v(a, a + lmi_array_size(a));
return contains(v, s);
}
diff --git a/mec_input.cpp b/mec_input.cpp
index 234d937..91f4c0e 100644
--- a/mec_input.cpp
+++ b/mec_input.cpp
@@ -33,7 +33,7 @@
#include "global_settings.hpp"
#include "input_sequence_aux.hpp" // convert_vector(),
convert_vector_type()
#include "map_lookup.hpp"
-#include "miscellany.hpp" // each_equal(), lmi_array_size()
+#include "miscellany.hpp" // each_equal()
#include <algorithm> // max()
#include <exception>
@@ -621,12 +621,11 @@ std::string const& mec_input::xml_root_name() const
bool mec_input::is_detritus(std::string const& s) const
{
- static std::string const a[] =
+ static std::vector<std::string> const v
{"DeprecatedUseDOB" // Renamed (without 'Deprecated'-).
,"EffectiveDateToday" // Withdrawn.
,"InforceSevenPayPremium" // Withdrawn.
};
- static std::vector<std::string> const v(a, a + lmi_array_size(a));
return contains(v, s);
}
diff --git a/mec_state.cpp b/mec_state.cpp
index 4963444..9a0dc90 100644
--- a/mec_state.cpp
+++ b/mec_state.cpp
@@ -26,7 +26,7 @@
#include "alert.hpp"
#include "contains.hpp"
-#include "miscellany.hpp" // htmlize(), lmi_array_size()
+#include "miscellany.hpp" // htmlize()
#include "value_cast.hpp"
#include "xml_lmi.hpp"
@@ -355,10 +355,9 @@ std::string const& mec_state::xml_root_name() const
bool mec_state::is_detritus(std::string const& s) const
{
- static std::string const a[] =
+ static std::vector<std::string> const v
{"Remove this string when adding the first removed entity."
};
- static std::vector<std::string> const v(a, a + lmi_array_size(a));
return contains(v, s);
}
diff --git a/miscellany.hpp b/miscellany.hpp
index 7ef97fe..f4e102b 100644
--- a/miscellany.hpp
+++ b/miscellany.hpp
@@ -180,13 +180,6 @@ std::string iso_8601_datestamp_terse();
std::string iso_8601_datestamp_verbose();
-// to be expunged soon: duplicates lmi::size()
-template<typename T, auto n>
-inline std::size_t lmi_array_size(T(&)[n])
-{
- return n;
-}
-
inline bool is_ok_for_cctype(int c)
{
return (EOF == c) || (0 <= c && c <= UCHAR_MAX);
diff --git a/print_matrix_test.cpp b/print_matrix_test.cpp
index 3ca5182..83a7fb8 100644
--- a/print_matrix_test.cpp
+++ b/print_matrix_test.cpp
@@ -23,7 +23,6 @@
#include "print_matrix.hpp"
-#include "miscellany.hpp" // lmi_array_size()
#include "test_tools.hpp"
namespace
@@ -55,16 +54,14 @@ int test_main(int, char*[])
{
{
std::vector<double> q(sample_q());
- int d[] = {10, 1, 1, 2, 5};
- std::vector<int> dimensions(d, d + lmi_array_size(d));
+ std::vector<int> dimensions {10, 1, 1, 2, 5};
print_matrix(std::cout, q, dimensions);
std::cout << std::endl;
}
{
std::vector<double> q(1, 2.718281828459045);
- int d[] = {1, 1, 1, 1};
- std::vector<int> dimensions(d, d + lmi_array_size(d));
+ std::vector<int> dimensions {1, 1, 1, 1};
print_matrix(std::cout, q, dimensions);
std::cout << std::endl;
}
diff --git a/product_data.cpp b/product_data.cpp
index d1340be..19d5509 100644
--- a/product_data.cpp
+++ b/product_data.cpp
@@ -29,7 +29,6 @@
#include "contains.hpp"
#include "data_directory.hpp" // AddDataDir()
#include "map_lookup.hpp"
-#include "miscellany.hpp" // lmi_array_size()
#include "my_proem.hpp" // ::write_proem()
#include "xml_serialize.hpp"
@@ -372,13 +371,12 @@ void product_data::write_proem
bool product_data::is_detritus(std::string const& s) const
{
- static std::string const a[] =
+ static std::vector<std::string> const v
{"PresaleTrackingNumber" // renamed to ImprimaturPresale
,"CompositeTrackingNumber" // renamed to
ImprimaturPresaleComposite
,"InforceTrackingNumber" // renamed to ImprimaturInforce
,"InforceCompositeTrackingNumber" // renamed to
ImprimaturInforceComposite
};
- static std::vector<std::string> const v(a, a + lmi_array_size(a));
return contains(v, s);
}
diff --git a/stratified_algorithms_test.cpp b/stratified_algorithms_test.cpp
index 252ed47..50491c4 100644
--- a/stratified_algorithms_test.cpp
+++ b/stratified_algorithms_test.cpp
@@ -24,7 +24,6 @@
#include "stratified_algorithms.hpp"
#include "materially_equal.hpp"
-#include "miscellany.hpp" // lmi_array_size()
#include "test_tools.hpp"
#include <cmath> // fabs()
@@ -33,10 +32,8 @@
void banded_test()
{
double const m = std::numeric_limits<double>::max();
- double x[] = {1000.0 , 5000.0 , m };
- double y[] = { 0.05, 0.02, 0.01};
- std::vector<double> const limits(x, x + lmi_array_size(x));
- std::vector<double> const rates (y, y + lmi_array_size(y));
+ std::vector<double> const limits {1000.0 , 5000.0 , m };
+ std::vector<double> const rates { 0.05, 0.02, 0.01};
// At limits.
@@ -64,10 +61,8 @@ void banded_test()
// With some brackets of measure zero.
- double z_x[] = {0.0, 1000.0 , 1000.0, 1000.0, 5000.0 , m };
- double z_y[] = {9.9, 0.05, 8.8, 7.7, 0.02, 0.01};
- std::vector<double> const z_limits(z_x, z_x + lmi_array_size(z_x));
- std::vector<double> const z_rates (z_y, z_y + lmi_array_size(z_y));
+ std::vector<double> const z_limits {0.0, 1000.0 , 1000.0, 1000.0, 5000.0 ,
m };
+ std::vector<double> const z_rates {9.9, 0.05, 8.8, 7.7, 0.02,
0.01};
BOOST_TEST(materially_equal( 30.0, banded_product<double>()( 1500.0,
z_limits, z_rates)));
// In the vicinity of extrema.
@@ -130,10 +125,8 @@ void banded_test()
void tiered_test()
{
double const m = std::numeric_limits<double>::max();
- double x[] = {1000.0 , 4000.0 , m };
- double y[] = { 0.05, 0.02, 0.01};
- std::vector<double> const limits(x, x + lmi_array_size(x));
- std::vector<double> const rates (y, y + lmi_array_size(y));
+ std::vector<double> const limits {1000.0 , 4000.0 , m };
+ std::vector<double> const rates { 0.05, 0.02, 0.01};
// At limits.
@@ -171,10 +164,8 @@ void tiered_test()
// With some brackets of measure zero.
- double z_x[] = {0.0, 1000.0 , 0.0, 0.0, 4000.0 , m };
- double z_y[] = {9.9, 0.05, 8.8, 7.7, 0.02, 0.01};
- std::vector<double> const z_limits(z_x, z_x + lmi_array_size(z_x));
- std::vector<double> const z_rates (z_y, z_y + lmi_array_size(z_y));
+ std::vector<double> const z_limits {0.0, 1000.0 , 0.0, 0.0, 4000.0 , m };
+ std::vector<double> const z_rates {9.9, 0.05, 8.8, 7.7, 0.02, 0.01};
BOOST_TEST(materially_equal(175.0, tiered_product<double>()( 9900.0,
100.0, z_limits, z_rates)));
// In the vicinity of extrema.
diff --git a/xml_serializable.tpp b/xml_serializable.tpp
index 20d5b60..29a02e1 100644
--- a/xml_serializable.tpp
+++ b/xml_serializable.tpp
@@ -311,10 +311,9 @@ bool xml_serializable<T>::is_detritus(std::string const&)
const
return false;
// Pastable specimen implementation for derived classes:
#if 0
- static std::string const a[] =
+ static std::vector<std::string> const v
{"Remove this string when adding the first removed entity."
};
- static std::vector<std::string> const v(a, a + lmi_array_size(a));
return contains(v, s);
#endif // 0
}
diff --git a/xml_serialize_test.cpp b/xml_serialize_test.cpp
index 762026b..b7b58e9 100644
--- a/xml_serialize_test.cpp
+++ b/xml_serialize_test.cpp
@@ -23,7 +23,7 @@
#include "xml_serialize.hpp"
-#include "miscellany.hpp" // lmi_array_size(),
stifle_warning_for_unused_variable()
+#include "miscellany.hpp" // stifle_warning_for_unused_variable()
#include "test_tools.hpp"
#include "timer.hpp"
@@ -38,16 +38,12 @@ std::string dom_string;
int const number_of_elements = 20;
-// http://www.drpeppermuseum.com/Learn/10-2-4-Club.aspx
-
-int const dr_pepper[] = {10, 2, 4};
-
// /[dsv]0/: constant values for /write.*/ functions.
// /[dsv]1/: variables for /read.*/ functions.
double const d0(2.718281828459045235360);
std::string const s0("string with ampersand & embedded spaces");
-std::vector<int> const v0(dr_pepper, dr_pepper + lmi_array_size(dr_pepper));
+std::vector<int> const v0 {10, 2, 4}; // Be a pepper...
double d1;
std::string s1;