diff --git a/include/rexy/detail/hasallocator.hpp b/include/rexy/detail/hasallocator.hpp index 9182496..abd761b 100644 --- a/include/rexy/detail/hasallocator.hpp +++ b/include/rexy/detail/hasallocator.hpp @@ -26,47 +26,17 @@ namespace rexy::detail{ - template> - struct hasallocator - { - Alloc m_alloc; - - REXY_CPP20_CONSTEXPR auto allocate(typename Alloc::size_type bytes)noexcept(is_nothrow_allocator_v){ - return m_alloc.allocate(bytes); - } - REXY_CPP20_CONSTEXPR void deallocate(typename Alloc::pointer p, typename Alloc::size_type bytes)noexcept(is_nothrow_allocator_v){ - m_alloc.deallocate(p, bytes); - } - - constexpr Alloc& allocator(void){ - return m_alloc; - } - constexpr const Alloc& allocator(void)const{ - return m_alloc; - } - }; -#if __has_cpp_attribute(no_unique_address) template - struct hasallocator - { - [[no_unique_address]] - Alloc m_alloc; - - REXY_CPP20_CONSTEXPR auto allocate(typename Alloc::size_type bytes)noexcept(is_nothrow_allocator_v){ - return m_alloc.allocate(bytes); - } - REXY_CPP20_CONSTEXPR void deallocate(typename Alloc::pointer p, typename Alloc::size_type bytes)noexcept(is_nothrow_allocator_v){ - m_alloc.deallocate(p, bytes); - } - + struct hasallocator : public Alloc{ + using Alloc::Alloc; + using Alloc::operator=; constexpr Alloc& allocator(void){ - return m_alloc; + return *this; } constexpr const Alloc& allocator(void)const{ - return m_alloc; + return *this; } }; -#endif //no_unique_address } #endif