lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master e331b58 1/4: Move a defaulted dtor out of its


From: Greg Chicares
Subject: [lmi-commits] [lmi] master e331b58 1/4: Move a defaulted dtor out of its header (for unique_ptr)
Date: Sat, 6 Feb 2021 09:00:15 -0500 (EST)

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

    Move a defaulted dtor out of its header (for unique_ptr)
    
    * basic_values.hpp: To prepare for holding objects of some forward-
      declared classes by std::unique_ptr, moved dtor out of header.
    * basicvalues.cpp: Moved dtor into TU.
    * ihs_basicval.cpp: Likewise.
    * ihs_irc7702.cpp: Adopted a uniform comment block that better explains
      the dtor rationale, specifically mentioning std::unique_ptr.
---
 basic_values.hpp | 2 +-
 basicvalues.cpp  | 9 +++++++++
 ihs_basicval.cpp | 9 +++++++++
 ihs_irc7702.cpp  | 7 ++++---
 4 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/basic_values.hpp b/basic_values.hpp
index 9bb237f..e6771a4 100644
--- a/basic_values.hpp
+++ b/basic_values.hpp
@@ -96,7 +96,7 @@ class LMI_SO BasicValues
         ,double             a_TargetPremium
         );
     BasicValues(BasicValues&&) = default;
-    virtual ~BasicValues() = default;
+    virtual ~BasicValues();
 
     void Init();
 
diff --git a/basicvalues.cpp b/basicvalues.cpp
index 08a2d1b..659277a 100644
--- a/basicvalues.cpp
+++ b/basicvalues.cpp
@@ -85,6 +85,15 @@ BasicValues::BasicValues(Input const& input)
     Init();
 }
 
+/// Destructor.
+///
+/// Although it is explicitly defaulted, this destructor is not
+/// implemented inside the class definition, because the header
+/// forward-declares one or more classes that are held by
+/// std::unique_ptr, so their destructors are visible only here.
+
+BasicValues::~BasicValues() = default;
+
 //============================================================================
 void BasicValues::Init()
 {
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 9ca74f1..9010187 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -163,6 +163,15 @@ BasicValues::BasicValues
     Init();
 }
 
+/// Destructor.
+///
+/// Although it is explicitly defaulted, this destructor is not
+/// implemented inside the class definition, because the header
+/// forward-declares one or more classes that are held by
+/// std::unique_ptr, so their destructors are visible only here.
+
+BasicValues::~BasicValues() = default;
+
 //============================================================================
 void BasicValues::Init()
 {
diff --git a/ihs_irc7702.cpp b/ihs_irc7702.cpp
index a249014..c7355b3 100644
--- a/ihs_irc7702.cpp
+++ b/ihs_irc7702.cpp
@@ -204,9 +204,10 @@ Irc7702::Irc7702
 
 /// Destructor.
 ///
-/// Although it is explicitly defaulted, this destructor cannot be
-/// implemented inside the class definition, where a class type that
-/// it depends upon is incomplete.
+/// Although it is explicitly defaulted, this destructor is not
+/// implemented inside the class definition, because the header
+/// forward-declares one or more classes that are held by
+/// std::unique_ptr, so their destructors are visible only here.
 
 Irc7702::~Irc7702() = default;
 



reply via email to

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