diff options
Diffstat (limited to 'test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp')
-rw-r--r-- | test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp index 42b41fd7b867..9db1e5c70732 100644 --- a/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp +++ b/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp @@ -19,6 +19,7 @@ #include "MoveOnly.h" #include "min_allocator.h" +#include "test_macros.h" int main() { @@ -52,7 +53,7 @@ int main() assert(r->first == 3); assert(r->second == 3); } -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M; typedef std::pair<int, MoveOnly> P; @@ -83,5 +84,35 @@ int main() assert(r->second == 3); } #endif +#if TEST_STD_VER > 14 + { + typedef std::map<int, MoveOnly> M; + typedef M::iterator R; + M m; + R r = m.insert(m.end(), {2, MoveOnly(2)}); + assert(r == m.begin()); + assert(m.size() == 1); + assert(r->first == 2); + assert(r->second == 2); + + r = m.insert(m.end(), {1, MoveOnly(1)}); + assert(r == m.begin()); + assert(m.size() == 2); + assert(r->first == 1); + assert(r->second == 1); + + r = m.insert(m.end(), {3, MoveOnly(3)}); + assert(r == prev(m.end())); + assert(m.size() == 3); + assert(r->first == 3); + assert(r->second == 3); + + r = m.insert(m.end(), {3, MoveOnly(3)}); + assert(r == prev(m.end())); + assert(m.size() == 3); + assert(r->first == 3); + assert(r->second == 3); + } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } |