1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <map> 11 12 // class multimap 13 14 // template <class P> 15 // iterator insert(P&& p); 16 17 #include <map> 18 #include <cassert> 19 20 #include "../../../MoveOnly.h" 21 main()22int main() 23 { 24 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 25 { 26 typedef std::multimap<int, MoveOnly> M; 27 typedef M::iterator R; 28 M m; 29 R r = m.insert(M::value_type(2, 2)); 30 assert(r == m.begin()); 31 assert(m.size() == 1); 32 assert(r->first == 2); 33 assert(r->second == 2); 34 35 r = m.insert(M::value_type(1, 1)); 36 assert(r == m.begin()); 37 assert(m.size() == 2); 38 assert(r->first == 1); 39 assert(r->second == 1); 40 41 r = m.insert(M::value_type(3, 3)); 42 assert(r == prev(m.end())); 43 assert(m.size() == 3); 44 assert(r->first == 3); 45 assert(r->second == 3); 46 47 r = m.insert(M::value_type(3, 3)); 48 assert(r == prev(m.end())); 49 assert(m.size() == 4); 50 assert(r->first == 3); 51 assert(r->second == 3); 52 } 53 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 54 } 55