diff --git a/test/allocator_argument_tester.hpp b/test/allocator_argument_tester.hpp index 909204f..7afd293 100644 --- a/test/allocator_argument_tester.hpp +++ b/test/allocator_argument_tester.hpp @@ -13,6 +13,7 @@ #include #include +#include #include template @@ -69,17 +70,10 @@ class propagation_test_allocator { return std::size_t(-1); } value_type* allocate(std::size_t count) - { return static_cast(::operator new(count * sizeof(value_type))); } + { return boost::container::dtl::operator_new_allocate(count); } void deallocate(value_type *ptr, std::size_t n) - { - (void)n; - # if defined(__cpp_sized_deallocation) - ::operator delete((void*)ptr, n * sizeof(value_type)); - #else - ::operator delete((void*)ptr); - # endif - } + { return boost::container::dtl::operator_delete_deallocate(ptr, n); } bool m_move_contructed; bool m_move_assigned; diff --git a/test/dummy_test_allocator.hpp b/test/dummy_test_allocator.hpp index 5e4d751..7a32186 100644 --- a/test/dummy_test_allocator.hpp +++ b/test/dummy_test_allocator.hpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -59,18 +60,11 @@ class simple_allocator simple_allocator(const simple_allocator &) {} - T* allocate(std::size_t n) - { return (T*) ::operator new(sizeof(T) * n); } + value_type* allocate(std::size_t count) + { return boost::container::dtl::operator_new_allocate(count); } - void deallocate(T *ptr, std::size_t n) BOOST_NOEXCEPT_OR_NOTHROW - { - (void)n; - # if defined(__cpp_sized_deallocation) - ::operator delete((void*)ptr, n * sizeof(T)); - #else - ::operator delete((void*)ptr); - # endif - } + void deallocate(value_type *ptr, std::size_t n) + { return boost::container::dtl::operator_delete_deallocate(ptr, n); } friend bool operator==(const simple_allocator &, const simple_allocator &) { return true; } @@ -181,18 +175,11 @@ class propagation_test_allocator static void reset_unique_id(unsigned id = 0) { unique_id_ = id; } - T* allocate(std::size_t n) - { return static_cast(::operator new(n * sizeof(T))); } + value_type* allocate(std::size_t count) + { return boost::container::dtl::operator_new_allocate(count); } - void deallocate(T *ptr, std::size_t n) BOOST_NOEXCEPT_OR_NOTHROW - { - (void)n; - # if defined(__cpp_sized_deallocation) - ::operator delete((void*)ptr, n * sizeof(T)); - #else - ::operator delete((void*)ptr); - # endif - } + void deallocate(value_type *ptr, std::size_t n) + { return boost::container::dtl::operator_delete_deallocate(ptr, n); } friend bool operator==(const propagation_test_allocator &a, const propagation_test_allocator &b) { return EqualIfEqualIds ? a.id_ == b.id_ : true; }