summaryrefslogtreecommitdiff
path: root/boost/container/allocator.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:24:45 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:24:45 +0900
commit5ce1cfc2525b06c0a9e38531813781de0281c96d (patch)
tree19cc66c6cf6396db288813b2558cc350f1deede2 /boost/container/allocator.hpp
parent3c1df2168531ad5580076ae08d529054689aeedd (diff)
downloadboost-5ce1cfc2525b06c0a9e38531813781de0281c96d.tar.gz
boost-5ce1cfc2525b06c0a9e38531813781de0281c96d.tar.bz2
boost-5ce1cfc2525b06c0a9e38531813781de0281c96d.zip
Imported Upstream version 1.71.0upstream/1.71.0
Diffstat (limited to 'boost/container/allocator.hpp')
-rw-r--r--boost/container/allocator.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/boost/container/allocator.hpp b/boost/container/allocator.hpp
index aef620ce59..a14c59ebe5 100644
--- a/boost/container/allocator.hpp
+++ b/boost/container/allocator.hpp
@@ -180,7 +180,7 @@ class allocator
pointer allocate(size_type count, const void * hint= 0)
{
(void)hint;
- if(count > this->max_size())
+ if(count > size_type(-1)/(2u*sizeof(T)))
boost::container::throw_bad_alloc();
void *ret = dlmalloc_malloc(count*sizeof(T));
if(!ret)
@@ -196,7 +196,7 @@ class allocator
//!Returns the maximum number of elements that could be allocated.
//!Never throws
BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW
- { return size_type(-1)/sizeof(T); }
+ { return size_type(-1)/(2u*sizeof(T)); }
//!Swaps two allocators, does nothing
//!because this allocator is stateless