diff --git a/include/boost/core/default_allocator.hpp b/include/boost/core/default_allocator.hpp index 9fc3ea2..a366f62 100644 --- a/include/boost/core/default_allocator.hpp +++ b/include/boost/core/default_allocator.hpp @@ -9,8 +9,8 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_CORE_DEFAULT_ALLOCATOR_HPP #include +#include #include -#include #if defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 60000 #define BOOST_CORE_NO_CXX11_ALLOCATOR @@ -81,16 +81,12 @@ struct default_allocator { BOOST_CONSTEXPR default_allocator(const default_allocator&) BOOST_NOEXCEPT { } -#if defined(PTRDIFF_MAX) && defined(SIZE_MAX) BOOST_CONSTEXPR std::size_t max_size() const BOOST_NOEXCEPT { - return PTRDIFF_MAX < SIZE_MAX / sizeof(T) - ? PTRDIFF_MAX : SIZE_MAX / sizeof(T); + return std::numeric_limits::max() + < std::numeric_limits::max() / sizeof(T) + ? std::numeric_limits::max() + : std::numeric_limits::max() / sizeof(T); } -#else - BOOST_CONSTEXPR std::size_t max_size() const BOOST_NOEXCEPT { - return ~static_cast(0) / sizeof(T); - } -#endif #if !defined(BOOST_NO_EXCEPTIONS) T* allocate(std::size_t n) {