diff options
Diffstat (limited to 'libcxx/test/containers/associative/map/map.access/index_key.pass.cpp')
-rw-r--r-- | libcxx/test/containers/associative/map/map.access/index_key.pass.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp b/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp index fb82bbedf81..7579088784c 100644 --- a/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp +++ b/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp @@ -16,8 +16,11 @@ #include <map> #include <cassert> +#include "../../../min_allocator.h" + int main() { + { typedef std::pair<const int, double> V; V ar[] = { @@ -41,4 +44,33 @@ int main() m[6] = 6.5; assert(m[6] == 6.5); assert(m.size() == 8); + } +#if __cplusplus >= 201103L + { + typedef std::pair<const int, double> V; + V ar[] = + { + V(1, 1.5), + V(2, 2.5), + V(3, 3.5), + V(4, 4.5), + V(5, 5.5), + V(7, 7.5), + V(8, 8.5), + }; + std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0])); + assert(m.size() == 7); + assert(m[1] == 1.5); + assert(m.size() == 7); + const int i = 1; + m[i] = -1.5; + assert(m[1] == -1.5); + assert(m.size() == 7); + assert(m[6] == 0); + assert(m.size() == 8); + m[6] = 6.5; + assert(m[6] == 6.5); + assert(m.size() == 8); + } +#endif } |