From e859d0118683d8d642abee621965f12d59337651 Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Thu, 25 Apr 2019 12:11:34 -0400 Subject: [PATCH] Correct max_size() when PTRDIFF_MAX is less than SIZE_MAX --- include/boost/core/default_allocator.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/core/default_allocator.hpp b/include/boost/core/default_allocator.hpp index eadd293..b108e1a 100644 --- a/include/boost/core/default_allocator.hpp +++ b/include/boost/core/default_allocator.hpp @@ -61,7 +61,7 @@ struct default_allocator { BOOST_CONSTEXPR std::size_t max_size() const BOOST_NOEXCEPT { #if defined(PTRDIFF_MAX) && defined(SIZE_MAX) && (PTRDIFF_MAX < SIZE_MAX) - return PTRDIFF_MAX / sizeof(T); + return PTRDIFF_MAX; #else return ~static_cast(0) / sizeof(T); #endif