[mlir][acc] Introduce MappableType interface (#122146)
[llvm-project.git] / libcxx / test / std / containers / associative / multiset / insert_iter_cv.pass.cpp
blob242e801c2acbfac36060f9cb38fdea8822acb3cd
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 // <set>
11 // class multiset
13 // iterator insert(const_iterator position, const value_type& v);
15 #include <set>
16 #include <cassert>
18 #include "test_macros.h"
19 #include "min_allocator.h"
21 int main(int, char**)
24 typedef std::multiset<int> M;
25 typedef M::iterator R;
26 M m;
27 R r = m.insert(m.cend(), M::value_type(2));
28 assert(r == m.begin());
29 assert(m.size() == 1);
30 assert(*r == 2);
32 r = m.insert(m.cend(), M::value_type(1));
33 assert(r == m.begin());
34 assert(m.size() == 2);
35 assert(*r == 1);
37 r = m.insert(m.cend(), M::value_type(3));
38 assert(r == std::prev(m.end()));
39 assert(m.size() == 3);
40 assert(*r == 3);
42 r = m.insert(m.cend(), M::value_type(3));
43 assert(r == std::prev(m.end()));
44 assert(m.size() == 4);
45 assert(*r == 3);
47 #if TEST_STD_VER >= 11
49 typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
50 typedef M::iterator R;
51 M m;
52 R r = m.insert(m.cend(), M::value_type(2));
53 assert(r == m.begin());
54 assert(m.size() == 1);
55 assert(*r == 2);
57 r = m.insert(m.cend(), M::value_type(1));
58 assert(r == m.begin());
59 assert(m.size() == 2);
60 assert(*r == 1);
62 r = m.insert(m.cend(), M::value_type(3));
63 assert(r == std::prev(m.end()));
64 assert(m.size() == 3);
65 assert(*r == 3);
67 r = m.insert(m.cend(), M::value_type(3));
68 assert(r == std::prev(m.end()));
69 assert(m.size() == 4);
70 assert(*r == 3);
72 #endif
74 return 0;