diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2016-08-17 05:58:40 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2016-08-17 05:58:40 +0000 |
commit | 2a10c960fa33b7048b48107823f5879cf301dece (patch) | |
tree | 055ff7b53c98af2ffcc7abc42a03e4aa1b42f502 /libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp | |
parent | 14f383e9c4b776d415cbc66902d8492dbcc0c0e1 (diff) | |
download | bcm5719-llvm-2a10c960fa33b7048b48107823f5879cf301dece.tar.gz bcm5719-llvm-2a10c960fa33b7048b48107823f5879cf301dece.zip |
Support allocators with explicit conversion constructors. Fixes bug #29000
llvm-svn: 278904
Diffstat (limited to 'libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp')
-rw-r--r-- | libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp index 8a9f7c86a2c..8391ebab045 100644 --- a/libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp +++ b/libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp @@ -91,5 +91,39 @@ int main() assert(*next(mo.begin()) == V(2, 1)); assert(*next(mo.begin(), 2) == V(3, 1)); } + { + typedef std::pair<const int, double> V; + V ar[] = + { + V(1, 1), + V(1, 1.5), + V(1, 2), + V(2, 1), + V(2, 1.5), + V(2, 2), + V(3, 1), + V(3, 1.5), + V(3, 2), + }; + typedef test_compare<std::less<int> > C; + typedef explicit_allocator<V> A; + std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A{}); + std::map<int, double, C, A> m(mo, A{}); + assert(m.get_allocator() == A()); + assert(m.key_comp() == C(5)); + assert(m.size() == 3); + assert(distance(m.begin(), m.end()) == 3); + assert(*m.begin() == V(1, 1)); + assert(*next(m.begin()) == V(2, 1)); + assert(*next(m.begin(), 2) == V(3, 1)); + + assert(mo.get_allocator() == A()); + assert(mo.key_comp() == C(5)); + assert(mo.size() == 3); + assert(distance(mo.begin(), mo.end()) == 3); + assert(*mo.begin() == V(1, 1)); + assert(*next(mo.begin()) == V(2, 1)); + assert(*next(mo.begin(), 2) == V(3, 1)); + } #endif } |