diff --git a/src/Core/SmartPointer.h b/src/Core/SmartPointer.h index 8448d4c..496d367 100644 --- a/src/Core/SmartPointer.h +++ b/src/Core/SmartPointer.h @@ -56,8 +56,13 @@ public: /** * @brief Default constructor. + * Allocates a new T following legacy behavior. */ - SmartPointer() noexcept : m_counter(nullptr) {} + SmartPointer() : m_counter(nullptr) { + if constexpr (std::is_default_constructible_v) { + m_counter = new ReferenceCounter(new T()); + } + } /** * @brief Constructor from nullptr.