From a48980a83a0728935920583b8fa491bccd479a12 Mon Sep 17 00:00:00 2001 From: Gary Granger Date: Thu, 30 Jun 2022 12:36:29 -0600 Subject: [PATCH] avoid implicit destructor in BSplineBase.h allows BSplineBase.h to be included by itself when the explicit instantation will be linked from elsewhere. create v2.2. --- BSpline/BSpline.dox | 5 +++++ BSpline/BSplineBase.cpp | 9 +++++++++ BSpline/BSplineBase.h | 4 ++++ BSpline/BSplineVersion.h | 2 +- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/BSpline/BSpline.dox b/BSpline/BSpline.dox index 7fed79f..8276f6b 100644 --- a/BSpline/BSpline.dox +++ b/BSpline/BSpline.dox @@ -50,6 +50,11 @@ The HTML documentation is generated from the source files by Doxygen @section releasenotes Release Notes +

Release 2.2

+ +Restore the explicit destructor so BSplineBase.h can be used by itself when +explicit instantiations will be linked from a library. +

Release 2.1

Fix missing assignment operator bug in BSplineBase. Thanks to @@AlexRockliff diff --git a/BSpline/BSplineBase.cpp b/BSpline/BSplineBase.cpp index 5c8f808..9cd7bac 100644 --- a/BSpline/BSplineBase.cpp +++ b/BSpline/BSplineBase.cpp @@ -175,6 +175,15 @@ BSplineBase::BSplineBase(const T* x, int nx, double wl, int bc, setDomain(x, nx, wl, bc, num_nodes); } +// The destructor is declared in the class definition but not defined so the +// compiler does not try to generate it when the full implementation is not +// available. The implicit destructor fails to instantiate when BSplineBaseP +// is still incomplete, because the std::unique_ptr destructor +// cannot be instantiated. To fully instantiate BSplineBase, this file has to +// be included. The header alone can be used when the template is explicitly +// instantiated elsewhere. +template BSplineBase::~BSplineBase() {} + template bool BSplineBase::setDomain(const T* x, int nx, double wl, int bc, int num_nodes) diff --git a/BSpline/BSplineBase.h b/BSpline/BSplineBase.h index 2feab3a..e33d871 100644 --- a/BSpline/BSplineBase.h +++ b/BSpline/BSplineBase.h @@ -208,6 +208,10 @@ template class BSplineBase /// Assignment operator BSplineBase& operator=(const BSplineBase& right); + // Declare the destructor so it is not implicitly instantiated. It can + // only be instantiated with the full implementation in BSplineBase.cpp. + ~BSplineBase(); + /** * Change the domain of this base. [If this is part of a BSpline * object, this method {\em will not} change the existing curve or diff --git a/BSpline/BSplineVersion.h b/BSpline/BSplineVersion.h index 94bf045..a1dde7f 100644 --- a/BSpline/BSplineVersion.h +++ b/BSpline/BSplineVersion.h @@ -20,7 +20,7 @@ #define bspline_str(s) #s #define BSPLINE_VERSION bspline_xstr(BSPLINE_AUTO_REVISION) #else -#define BSPLINE_VERSION "v2.1-x" +#define BSPLINE_VERSION "v2.2" #endif #define BSPLINE_URL "https://github.com/NCAR/bspline"