diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-11-23 01:18:56 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-11-23 01:18:56 +0000 |
commit | 55b31b4e6934fb2e9dda6d7f0f2792b6c3420c05 (patch) | |
tree | c5f77e59cac52f369638c0016587bf7b53a601c0 /libcxx/test/support/test_allocator.h | |
parent | 80e66ac1d3cdb67a35ca0c57f8e4a00cacd0f019 (diff) | |
download | bcm5719-llvm-55b31b4e6934fb2e9dda6d7f0f2792b6c3420c05.tar.gz bcm5719-llvm-55b31b4e6934fb2e9dda6d7f0f2792b6c3420c05.zip |
[libcxx] Fix max_size() across all containers
Summary: The `max_size()` method of containers should respect both the allocator's reported `max_size` and the range of the `difference_type`. This patch makes all containers choose the smallest of those two values.
Reviewers: mclow.lists, EricWF
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D26885
llvm-svn: 287729
Diffstat (limited to 'libcxx/test/support/test_allocator.h')
-rw-r--r-- | libcxx/test/support/test_allocator.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libcxx/test/support/test_allocator.h b/libcxx/test/support/test_allocator.h index 4e93ca5a918..7ce60025f68 100644 --- a/libcxx/test/support/test_allocator.h +++ b/libcxx/test/support/test_allocator.h @@ -20,6 +20,12 @@ #include "test_macros.h" +template <class Alloc> +inline size_t alloc_max_size(Alloc const &a) { + typedef std::allocator_traits<Alloc> AT; + return AT::max_size(a); +} + class test_alloc_base { protected: |