Made destructor compatible with C++03

This commit is contained in:
John Wellbelove 2025-06-11 10:13:19 +01:00
parent 400d6d7da0
commit 130859c3b7

View File

@ -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>().~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>().~T();
valid = false;
}
//***************************************************************************
/// \returns a pointer of type T and asserts if has_value() is false.
//***************************************************************************