From e4977a82182705fdc94216f90c063d6b3a3bf8bd Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 11 Jun 2025 10:13:19 +0100 Subject: [PATCH] Made destructor compatible with C++03 --- include/etl/alignment.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/include/etl/alignment.h b/include/etl/alignment.h index dab55832..1115aa92 100644 --- a/include/etl/alignment.h +++ b/include/etl/alignment.h @@ -378,16 +378,8 @@ namespace etl /// Default destructor which will NOT call the destructor of the object which /// was created by calling create(). //*************************************************************************** - ~typed_storage() = default; - - //*************************************************************************** - /// Calls the destructor of the wrapped object and asserts if has_value() is false. - //*************************************************************************** - void destroy() + ~typed_storage() { - ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error)); - data.template get_reference().~T(); - valid = false; } //*************************************************************************** @@ -471,6 +463,16 @@ namespace etl } #endif + //*************************************************************************** + /// Calls the destructor of the wrapped object and asserts if has_value() is false. + //*************************************************************************** + void destroy() + { + ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error)); + data.template get_reference().~T(); + valid = false; + } + //*************************************************************************** /// \returns a pointer of type T and asserts if has_value() is false. //***************************************************************************