blob: b77307861f0c543ea8ee60081784d34c20d355b4 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-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 set
13
14// pair<iterator, bool> insert(value_type&& v);
15
16#include <set>
17#include <cassert>
18
19#include "../../MoveOnly.h"
20
21int main()
22{
23#ifdef _LIBCPP_MOVE
24 {
25 typedef std::set<MoveOnly> M;
26 typedef std::pair<M::iterator, bool> R;
27 M m;
28 R r = m.insert(M::value_type(2));
29 assert(r.second);
30 assert(r.first == m.begin());
31 assert(m.size() == 1);
32 assert(*r.first == 2);
33
34 r = m.insert(M::value_type(1));
35 assert(r.second);
36 assert(r.first == m.begin());
37 assert(m.size() == 2);
38 assert(*r.first == 1);
39
40 r = m.insert(M::value_type(3));
41 assert(r.second);
42 assert(r.first == prev(m.end()));
43 assert(m.size() == 3);
44 assert(*r.first == 3);
45
46 r = m.insert(M::value_type(3));
47 assert(!r.second);
48 assert(r.first == prev(m.end()));
49 assert(m.size() == 3);
50 assert(*r.first == 3);
51 }
52#endif
53}