[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / containers / associative / multimap / multimap.special / member_swap.pass.cpp
blobdfe2831890569efdbe5b69bb662b75d78b2b9156
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 // <map>
11 // class multimap
13 // void swap(multimap& m);
15 #include <map>
16 #include <cassert>
18 #include "test_macros.h"
19 #include "min_allocator.h"
21 int main(int, char**)
23 typedef std::pair<const int, double> V;
25 typedef std::multimap<int, double> M;
27 M m1;
28 M m2;
29 M m1_save = m1;
30 M m2_save = m2;
31 m1.swap(m2);
32 assert(m1 == m2_save);
33 assert(m2 == m1_save);
36 V ar2[] =
38 V(5, 5),
39 V(6, 6),
40 V(7, 7),
41 V(8, 8),
42 V(9, 9),
43 V(10, 10),
44 V(11, 11),
45 V(12, 12)
47 M m1;
48 M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
49 M m1_save = m1;
50 M m2_save = m2;
51 m1.swap(m2);
52 assert(m1 == m2_save);
53 assert(m2 == m1_save);
56 V ar1[] =
58 V(1, 1),
59 V(2, 2),
60 V(3, 3),
61 V(4, 4)
63 M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
64 M m2;
65 M m1_save = m1;
66 M m2_save = m2;
67 m1.swap(m2);
68 assert(m1 == m2_save);
69 assert(m2 == m1_save);
72 V ar1[] =
74 V(1, 1),
75 V(2, 2),
76 V(3, 3),
77 V(4, 4)
79 V ar2[] =
81 V(5, 5),
82 V(6, 6),
83 V(7, 7),
84 V(8, 8),
85 V(9, 9),
86 V(10, 10),
87 V(11, 11),
88 V(12, 12)
90 M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
91 M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
92 M m1_save = m1;
93 M m2_save = m2;
94 m1.swap(m2);
95 assert(m1 == m2_save);
96 assert(m2 == m1_save);
99 #if TEST_STD_VER >= 11
101 typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
103 M m1;
104 M m2;
105 M m1_save = m1;
106 M m2_save = m2;
107 m1.swap(m2);
108 assert(m1 == m2_save);
109 assert(m2 == m1_save);
112 V ar2[] =
114 V(5, 5),
115 V(6, 6),
116 V(7, 7),
117 V(8, 8),
118 V(9, 9),
119 V(10, 10),
120 V(11, 11),
121 V(12, 12)
123 M m1;
124 M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
125 M m1_save = m1;
126 M m2_save = m2;
127 m1.swap(m2);
128 assert(m1 == m2_save);
129 assert(m2 == m1_save);
132 V ar1[] =
134 V(1, 1),
135 V(2, 2),
136 V(3, 3),
137 V(4, 4)
139 M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
140 M m2;
141 M m1_save = m1;
142 M m2_save = m2;
143 m1.swap(m2);
144 assert(m1 == m2_save);
145 assert(m2 == m1_save);
148 V ar1[] =
150 V(1, 1),
151 V(2, 2),
152 V(3, 3),
153 V(4, 4)
155 V ar2[] =
157 V(5, 5),
158 V(6, 6),
159 V(7, 7),
160 V(8, 8),
161 V(9, 9),
162 V(10, 10),
163 V(11, 11),
164 V(12, 12)
166 M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
167 M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
168 M m1_save = m1;
169 M m2_save = m2;
170 m1.swap(m2);
171 assert(m1 == m2_save);
172 assert(m2 == m1_save);
175 #endif
177 return 0;