[mlir][acc] Introduce MappableType interface (#122146)
[llvm-project.git] / libcxx / test / std / containers / associative / multiset / insert_iter_rv.pass.cpp
blob75df25e9b0999ab55f310261d8acc0cefe2814a6
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03
11 // <set>
13 // class multiset
15 // iterator insert(const_iterator position, value_type&& v);
17 #include <set>
18 #include <cassert>
20 #include "test_macros.h"
21 #include "MoveOnly.h"
22 #include "min_allocator.h"
24 int main(int, char**)
27 typedef std::multiset<MoveOnly> M;
28 typedef M::iterator R;
29 M m;
30 R r = m.insert(m.cend(), M::value_type(2));
31 assert(r == m.begin());
32 assert(m.size() == 1);
33 assert(*r == 2);
35 r = m.insert(m.cend(), M::value_type(1));
36 assert(r == m.begin());
37 assert(m.size() == 2);
38 assert(*r == 1);
40 r = m.insert(m.cend(), M::value_type(3));
41 assert(r == std::prev(m.end()));
42 assert(m.size() == 3);
43 assert(*r == 3);
45 r = m.insert(m.cend(), M::value_type(3));
46 assert(r == std::prev(m.end()));
47 assert(m.size() == 4);
48 assert(*r == 3);
51 typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
52 typedef M::iterator R;
53 M m;
54 R r = m.insert(m.cend(), M::value_type(2));
55 assert(r == m.begin());
56 assert(m.size() == 1);
57 assert(*r == 2);
59 r = m.insert(m.cend(), M::value_type(1));
60 assert(r == m.begin());
61 assert(m.size() == 2);
62 assert(*r == 1);
64 r = m.insert(m.cend(), M::value_type(3));
65 assert(r == std::prev(m.end()));
66 assert(m.size() == 3);
67 assert(*r == 3);
69 r = m.insert(m.cend(), M::value_type(3));
70 assert(r == std::prev(m.end()));
71 assert(m.size() == 4);
72 assert(*r == 3);
75 return 0;