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 // <set> 11 12 // class set 13 14 // iterator insert(const_iterator position, value_type&& v); 15 16 #include <set> 17 #include <cassert> 18 19 #include "../../MoveOnly.h" 20 main()21int main() 22 { 23 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 24 { 25 typedef std::set<MoveOnly> M; 26 typedef M::iterator R; 27 M m; 28 R r = m.insert(m.cend(), M::value_type(2)); 29 assert(r == m.begin()); 30 assert(m.size() == 1); 31 assert(*r == 2); 32 33 r = m.insert(m.cend(), M::value_type(1)); 34 assert(r == m.begin()); 35 assert(m.size() == 2); 36 assert(*r == 1); 37 38 r = m.insert(m.cend(), M::value_type(3)); 39 assert(r == prev(m.end())); 40 assert(m.size() == 3); 41 assert(*r == 3); 42 43 r = m.insert(m.cend(), M::value_type(3)); 44 assert(r == prev(m.end())); 45 assert(m.size() == 3); 46 assert(*r == 3); 47 } 48 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 49 } 50