lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 5c7028a 3/6: Write explicitly-defaulted [cd]t


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 5c7028a 3/6: Write explicitly-defaulted [cd]tor inline, in class defn
Date: Mon, 6 Mar 2017 19:46:58 -0500 (EST)

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

    Write explicitly-defaulted [cd]tor inline, in class defn
    
    This commit includes a ctor that had not been explicitly defaulted but
    could readily be, by substituting brace-or-equal-initializers for
    ctor-initializers.
---
 global_settings.cpp | 21 +--------------------
 global_settings.hpp | 25 +++++++++++++++----------
 2 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/global_settings.cpp b/global_settings.cpp
index b0bc0dc..fb74fc9 100644
--- a/global_settings.cpp
+++ b/global_settings.cpp
@@ -27,14 +27,7 @@
 #include "handle_exceptions.hpp"
 #include "path_utility.hpp"
 
-#include <boost/filesystem/operations.hpp>
-
-/// Initialize directory paths to ".", not an empty string. Reason:
-/// objects of the boost filesystem library's path class are created
-/// from these strings, which, if the strings were empty, would trigger
-/// exceptions when passed to that library's directory_iterator ctor.
-///
-/// 6.7/4 might seem to permit instance() to call this ctor before the
+/// 6.7/4 might seem to permit instance() to call the ctor before the
 /// first statement of main(); however, that is actually not permitted
 /// because it wouldn't meet the conditions of 3.6.2/2; cf.
 ///   
http://groups.google.com/group/comp.lang.c++.moderated/msg/f322587e93ce83fb
@@ -43,18 +36,6 @@
 /// default_name_check() will throw an exception, so there's no need
 /// to guard against such things here in any event.
 
-global_settings::global_settings()
-    :mellon_                    (false)
-    ,ash_nazg_                  (false)
-    ,pyx_                       ("")
-    ,custom_io_0_               (false)
-    ,regression_testing_        (false)
-    ,data_directory_            (fs::system_complete("."))
-    ,prospicience_date_         (last_yyyy_date())
-{}
-
-global_settings::~global_settings() = default;
-
 global_settings& global_settings::instance()
 {
     try
diff --git a/global_settings.hpp b/global_settings.hpp
index ecc8771..bd32bfb 100644
--- a/global_settings.hpp
+++ b/global_settings.hpp
@@ -27,6 +27,7 @@
 #include "calendar_date.hpp"
 #include "so_attributes.hpp"
 
+#include <boost/filesystem/operations.hpp> // fs::system_complete()
 #include <boost/filesystem/path.hpp>
 
 #include <string>
@@ -55,7 +56,11 @@
 /// haven't approved a product, because it is important to test new
 /// products before approval.
 ///
-/// data_directory_: Path to data files.
+/// data_directory_: Path to data files, initialized to ".", not an
+/// empty string. Reason: objects of the boost filesystem library's
+/// path class are created from these strings, which, if the strings
+/// were empty, would trigger exceptions when passed to that library's
+/// directory_iterator ctor.
 ///
 /// Directory members, whose names end in 'directory_', are stored as
 /// filesystem path objects because that is their nature. They are
@@ -86,18 +91,18 @@ class LMI_SO global_settings final
     calendar_date const& prospicience_date        () const;
 
   private:
-    global_settings();
-    ~global_settings();
+    global_settings() = default;
+    ~global_settings() = default;
     global_settings(global_settings const&) = delete;
     global_settings& operator=(global_settings const&) = delete;
 
-    bool mellon_;
-    bool ash_nazg_;
-    std::string pyx_;
-    bool custom_io_0_;
-    bool regression_testing_;
-    fs::path data_directory_;
-    calendar_date prospicience_date_;
+    bool mellon_                     {false};
+    bool ash_nazg_                   {false};
+    std::string pyx_                 {};
+    bool custom_io_0_                {false};
+    bool regression_testing_         {false};
+    fs::path data_directory_         {fs::system_complete(".")};
+    calendar_date prospicience_date_ {last_yyyy_date()};
 };
 
 #endif // global_settings_hpp



reply via email to

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