lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master cf2b515 1/3: Use braces to avoid the most vex


From: Greg Chicares
Subject: [lmi-commits] [lmi] master cf2b515 1/3: Use braces to avoid the most vexing parse
Date: Tue, 2 Apr 2019 07:23:55 -0400 (EDT)

branch: master
commit cf2b515e08aa2e7cbce46d6ca010b663961deb00
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Use braces to avoid the most vexing parse
---
 calendar_date.cpp           | 7 +++----
 wx_test_pdf_create.cpp      | 3 +--
 wx_test_validate_output.cpp | 4 +---
 wx_utility.cpp              | 5 ++---
 4 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/calendar_date.cpp b/calendar_date.cpp
index f80ade5..6524f1f 100644
--- a/calendar_date.cpp
+++ b/calendar_date.cpp
@@ -738,8 +738,7 @@ class birthdate_limit
 
     double operator()(double candidate)
         {
-        // Double parentheses circumvent the most vexing parse.
-        calendar_date z((jdn_t(bourn_cast<int>(candidate))));
+        calendar_date const z {jdn_t(bourn_cast<int>(candidate))};
         return offset_ + notional_age(z, as_of_date_, alb_anb_) - limit_age_;
         }
 
@@ -821,13 +820,13 @@ std::string month_name(int month)
 
 calendar_date const& gregorian_epoch()
 {
-    static calendar_date const z((jdn_t(calendar_date::gregorian_epoch_jdn)));
+    static calendar_date const z {jdn_t(calendar_date::gregorian_epoch_jdn)};
     return z;
 }
 
 calendar_date const& last_yyyy_date()
 {
-    static calendar_date const z((jdn_t(calendar_date::last_yyyy_date_jdn)));
+    static calendar_date const z {jdn_t(calendar_date::last_yyyy_date_jdn)};
     return z;
 }
 
diff --git a/wx_test_pdf_create.cpp b/wx_test_pdf_create.cpp
index 2240c86..a8009f0 100644
--- a/wx_test_pdf_create.cpp
+++ b/wx_test_pdf_create.cpp
@@ -94,8 +94,7 @@ LMI_WX_TEST_CASE(pdf_illustration)
     };
 
     // Create a new billion-dollar illustration.
-    // Double parentheses circumvent the most vexing parse.
-    wx_test_new_illustration ill((billion_dollar_illustration()));
+    wx_test_new_illustration ill {billion_dollar_illustration()};
 
     // Ensure that the output file doesn't exist in the first place.
     output_pdf_existence_checker output_pdf(get_current_document_name());
diff --git a/wx_test_validate_output.cpp b/wx_test_validate_output.cpp
index 9f31ad7..ca679d0 100644
--- a/wx_test_validate_output.cpp
+++ b/wx_test_validate_output.cpp
@@ -486,9 +486,7 @@ LMI_WX_TEST_CASE(validate_output_illustration)
     };
 
     // Create a new illustration with the special comment.
-
-    // Double parentheses circumvent the most vexing parse.
-    wx_test_new_illustration ill((enter_comment_in_illustration_dialog()));
+    wx_test_new_illustration ill {enter_comment_in_illustration_dialog()};
     ill.close_discard_changes();
 
     // And check that this resulted in the creation of the expected file.
diff --git a/wx_utility.cpp b/wx_utility.cpp
index b5c6432..78cadc0 100644
--- a/wx_utility.cpp
+++ b/wx_utility.cpp
@@ -152,7 +152,7 @@ bool operator==(wxDateTime const& wx_date, calendar_date 
const& lmi_date)
 
 void TestDateConversions()
 {
-    calendar_date const z((jdn_t(calendar_date::min_verified_jdn)));
+    calendar_date const z {jdn_t(calendar_date::min_verified_jdn)};
     int const low  = z               .julian_day_number();
     int const high = last_yyyy_date().julian_day_number();
     status()
@@ -165,8 +165,7 @@ void TestDateConversions()
         ;
     for(int j = low; j <= high; ++j)
         {
-        // Double parentheses circumvent the most vexing parse.
-        calendar_date const lmi_date0((jdn_t(j)));
+        calendar_date const lmi_date0 {jdn_t(j)};
         calendar_date const lmi_date1 =
             ConvertDateFromWx
                 (ConvertDateToWx



reply via email to

[Prev in Thread] Current Thread [Next in Thread]