[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 1b84f52 2/3: Prefer lmi::ssize(array) to size
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 1b84f52 2/3: Prefer lmi::ssize(array) to sizeof(array)/sizeof(array[0]) |
Date: |
Sun, 17 Jun 2018 20:08:36 -0400 (EDT) |
branch: master
commit 1b84f522131941fcfd671e46fb886822b18c0be9
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Prefer lmi::ssize(array) to sizeof(array)/sizeof(array[0])
---
group_quote_pdf_gen_wx.cpp | 3 ++-
input_sequence_entry.cpp | 2 +-
stratified_charges.cpp | 3 ++-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index d8784c4..a2413a1 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -39,6 +39,7 @@
#include "oecumenic_enumerations.hpp" // oenum_format_style
#include "path_utility.hpp" // fs::path inserter
#include "pdf_writer_wx.hpp"
+#include "ssize_lmi.hpp"
#include "version.hpp"
#include "wx_table_generator.hpp"
#include "wx_utility.hpp" // ConvertDateToWx()
@@ -258,7 +259,7 @@ column_definition const column_definitions[] =
,{"Total\n%s\nPremium" , "$9,999,999,999.00"} //
e_col_total_premium
};
-static_assert(sizeof column_definitions / sizeof(column_definitions[0]) ==
e_col_max);
+static_assert(lmi::ssize(column_definitions) == e_col_max);
class group_quote_pdf_generator_wx
:public group_quote_pdf_generator
diff --git a/input_sequence_entry.cpp b/input_sequence_entry.cpp
index 7d53d04..0eac2ea 100644
--- a/input_sequence_entry.cpp
+++ b/input_sequence_entry.cpp
@@ -86,7 +86,7 @@ choice_value const duration_mode_choice_values[] =
{e_maturity, "until maturity"}, // e_maturity must be last
};
-int const duration_mode_choices = sizeof(duration_mode_choice_values) /
sizeof(choice_value);
+int const duration_mode_choices = lmi::ssize(duration_mode_choice_values);
DurationModeChoice::DurationModeChoice(wxWindow* parent)
{
diff --git a/stratified_charges.cpp b/stratified_charges.cpp
index a5a57e1..5cffae5 100644
--- a/stratified_charges.cpp
+++ b/stratified_charges.cpp
@@ -31,6 +31,7 @@
#include "ieee754.hpp" // infinity<>()
#include "miscellany.hpp" // minmax
#include "my_proem.hpp" // ::write_proem()
+#include "ssize_lmi.hpp"
#include "stratified_algorithms.hpp"
#include "xml_lmi.hpp"
#include "xml_serialize.hpp"
@@ -243,7 +244,7 @@ namespace
,"stratified_last"
};
- static_assert(sizeof s_stratified_nodes / sizeof(char const*) == 1 +
e_stratified_last);
+ static_assert(lmi::ssize(s_stratified_nodes) == 1 + e_stratified_last);
} // Unnamed namespace.
stratified_entity& stratified_charges::raw_entity(e_stratified e)