diff --git a/Siv3D/include/Siv3D/ConstantBuffer.hpp b/Siv3D/include/Siv3D/ConstantBuffer.hpp index 8f1c2efc1..7d2e6e27a 100644 --- a/Siv3D/include/Siv3D/ConstantBuffer.hpp +++ b/Siv3D/include/Siv3D/ConstantBuffer.hpp @@ -77,8 +77,6 @@ namespace s3d SIV3D_NODISCARD_CXX20 ConstantBuffer(const Type& data); - ~ConstantBuffer(); - ConstantBuffer& operator =(const Type& data); [[nodiscard]] @@ -117,7 +115,15 @@ namespace s3d ConstantBufferBase m_base; - WrapperType* const m_wrapper = AlignedNew(); + struct Deleter + { + void operator()(WrapperType* p) const + { + AlignedDelete(p); + } + }; + + std::unique_ptr m_wrapper{ AlignedNew() }; bool m_hasDirty = true; }; diff --git a/Siv3D/include/Siv3D/detail/ConstantBuffer.ipp b/Siv3D/include/Siv3D/detail/ConstantBuffer.ipp index 1fb5d01f7..77808cb3c 100644 --- a/Siv3D/include/Siv3D/detail/ConstantBuffer.ipp +++ b/Siv3D/include/Siv3D/detail/ConstantBuffer.ipp @@ -24,12 +24,6 @@ namespace s3d m_wrapper->data = data; } - template - inline ConstantBuffer::~ConstantBuffer() - { - AlignedDelete(m_wrapper); - } - template inline ConstantBuffer& ConstantBuffer::operator =(const Type& data) {