diff --git a/include/rexy/buffer.hpp b/include/rexy/buffer.hpp index cc2d580..2368155 100644 --- a/include/rexy/buffer.hpp +++ b/include/rexy/buffer.hpp @@ -52,17 +52,16 @@ namespace rexy{ public: constexpr buffer(void); - REXY_CPP20_CONSTEXPR buffer(const_pointer data, size_type length)noexcept(noexcept(this->allocate(0))); + REXY_CPP20_CONSTEXPR buffer(const_pointer data, size_type length)noexcept(is_nothrow_allocator_v); template REXY_CPP20_CONSTEXPR buffer(const Iter& start, const Iter& last); - REXY_CPP20_CONSTEXPR buffer(size_type cap)noexcept(noexcept(this->allocate(0))); - REXY_CPP20_CONSTEXPR buffer(const buffer& b)noexcept(noexcept(this->allocate(0))); + REXY_CPP20_CONSTEXPR buffer(size_type cap)noexcept(is_nothrow_allocator_v); + REXY_CPP20_CONSTEXPR buffer(const buffer& b)noexcept(is_nothrow_allocator_v); constexpr buffer(buffer&& b)noexcept; - REXY_CPP20_CONSTEXPR ~buffer(void)noexcept(noexcept(this->deallocate(nullptr, 0))); + REXY_CPP20_CONSTEXPR ~buffer(void)noexcept(is_nothrow_allocator_v); REXY_CPP20_CONSTEXPR buffer& operator=(const buffer& b) - noexcept(noexcept(this->allocate(0)) && - noexcept(this->deallocate(nullptr, 0))); + noexcept(is_nothrow_allocator_v); constexpr buffer& operator=(buffer&& b)noexcept; constexpr pointer data(void); diff --git a/include/rexy/buffer.tpp b/include/rexy/buffer.tpp index 4675b3f..e335a6e 100644 --- a/include/rexy/buffer.tpp +++ b/include/rexy/buffer.tpp @@ -27,7 +27,7 @@ namespace rexy{ template constexpr buffer::buffer(void){} template - REXY_CPP20_CONSTEXPR buffer::buffer(const_pointer data, size_type length)noexcept(noexcept(this->allocate(0))): + REXY_CPP20_CONSTEXPR buffer::buffer(const_pointer data, size_type length)noexcept(is_nothrow_allocator_v): m_data(this->allocate(sizeof(value_type) * length)), m_cap(length), m_size(length) @@ -54,12 +54,12 @@ namespace rexy{ m_size = count; } template - REXY_CPP20_CONSTEXPR buffer::buffer(size_type cap)noexcept(noexcept(this->allocate(0))): + REXY_CPP20_CONSTEXPR buffer::buffer(size_type cap)noexcept(is_nothrow_allocator_v): m_data(this->allocate(sizeof(value_type) * cap)), m_cap(cap), m_size(0){} template - REXY_CPP20_CONSTEXPR buffer::buffer(const buffer& b)noexcept(noexcept(this->allocate(0))): + REXY_CPP20_CONSTEXPR buffer::buffer(const buffer& b)noexcept(is_nothrow_allocator_v): m_data(this->allocate(sizeof(value_type) * b.m_cap)), m_cap(b.m_cap), m_size(b.m_size) @@ -74,7 +74,7 @@ namespace rexy{ m_cap(b.m_cap), m_size(b.m_size){} template - REXY_CPP20_CONSTEXPR buffer::~buffer(void)noexcept(noexcept(this->deallocate(nullptr, 0))){ + REXY_CPP20_CONSTEXPR buffer::~buffer(void)noexcept(is_nothrow_allocator_v){ for(size_type i = 0;i < m_size;++i){ m_data[i].~T(); } @@ -82,8 +82,7 @@ namespace rexy{ } template REXY_CPP20_CONSTEXPR buffer& buffer::operator=(const buffer& b) - noexcept(noexcept(this->allocate(0)) && - noexcept(this->deallocate(nullptr, 0))) + noexcept(is_nothrow_allocator_v) { return (*this = buffer(b)); }