lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 9786086 4/5: s/enum/constexpr int/ for single


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 9786086 4/5: s/enum/constexpr int/ for single-enumerator enums
Date: Tue, 9 Nov 2021 15:03:44 -0500 (EST)

branch: master
commit 97860862d50e8511039b2c69342061d0afc917c9
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    s/enum/constexpr int/ for single-enumerator enums
---
 bourn_cast_test.cpp        | 4 ++--
 input_realization.cpp      | 2 +-
 ledger_invariant.cpp       | 4 ++--
 oecumenic_enumerations.hpp | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/bourn_cast_test.cpp b/bourn_cast_test.cpp
index 971140a..56ff18d 100644
--- a/bourn_cast_test.cpp
+++ b/bourn_cast_test.cpp
@@ -661,7 +661,7 @@ void test_boost_anomalies()
 template<typename To, typename From>
 void mete_static()
 {
-    enum {N = 1000000};
+    constexpr int N {1000000};
     using from_traits = std::numeric_limits<From>;
     static_assert(from_traits::is_specialized);
     static_assert(N < from_traits::max());
@@ -678,7 +678,7 @@ void mete_static()
 template<typename To, typename From>
 void mete_bourn()
 {
-    enum {N = 1000000};
+    constexpr int N {1000000};
     using from_traits = std::numeric_limits<From>;
     static_assert(from_traits::is_specialized);
     static_assert(N < from_traits::max());
diff --git a/input_realization.cpp b/input_realization.cpp
index bd4830c..92b9a93 100644
--- a/input_realization.cpp
+++ b/input_realization.cpp
@@ -199,7 +199,7 @@ std::vector<std::string> 
Input::RealizeAllSequenceInput(bool report_errors)
     // INPUT !! https://savannah.nongnu.org/support/?104481
     // This needs to be reimplemented.
     {
-    enum{NumberOfFunds = 30}; // DEPRECATED
+    constexpr int NumberOfFunds {30}; // DEPRECATED
     std::istringstream iss(FundAllocations.value());
     std::vector<tnr_unrestricted_double> v;
     for(;;)
diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
index 1347d60..9364a60 100644
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -527,8 +527,8 @@ void LedgerInvariant::Init()
     WriteTsvFile               = false;
     SupplementalReport         = true;
 
-    // Probably this should be an "oecumenic" enumeration.
-    enum {gregorian_epoch_jdn = 2361222};
+    // Probably this should be an "oecumenic" constant.
+    constexpr int gregorian_epoch_jdn {2361222};
     EffDateJdn                 = gregorian_epoch_jdn;
     DateOfBirthJdn             = gregorian_epoch_jdn;
     LastCoiReentryDateJdn      = gregorian_epoch_jdn;
diff --git a/oecumenic_enumerations.hpp b/oecumenic_enumerations.hpp
index b62a00b..ef0738c 100644
--- a/oecumenic_enumerations.hpp
+++ b/oecumenic_enumerations.hpp
@@ -24,9 +24,9 @@
 
 #include "config.hpp"
 
-/// Genesis 5:27.
+/// Genesis 5:27. Oecumenic, though not an enum.
 
-enum {methuselah = 969};
+constexpr int methuselah {969};
 
 enum oenum_7702_7pp_whence
     {oe_7702_7pp_first_principles



reply via email to

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