blob: 024689d656bb6d3a89c6542c2a441f0f16783d75 [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <set>
11
12// class multiset
13
14// iterator insert(value_type&& v);
15
16#include <set>
17#include <cassert>
18
19#include "../../MoveOnly.h"
20
21int main()
22{
Howard Hinnant73d21a42010-09-04 23:28:19 +000023#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000024 {
25 typedef std::multiset<MoveOnly> M;
26 typedef M::iterator R;
27 M m;
28 R r = m.insert(M::value_type(2));
29 assert(r == m.begin());
30 assert(m.size() == 1);
31 assert(*r == 2);
32
33 r = m.insert(M::value_type(1));
34 assert(r == m.begin());
35 assert(m.size() == 2);
36 assert(*r == 1);
37
38 r = m.insert(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::value_type(3));
44 assert(r == prev(m.end()));
45 assert(m.size() == 4);
46 assert(*r == 3);
47 }
Howard Hinnant73d21a42010-09-04 23:28:19 +000048#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000049}