1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
15 // multiset& operator=(multiset&& s);
20 #include "test_macros.h"
22 #include "../../../test_compare.h"
23 #include "test_allocator.h"
24 #include "min_allocator.h"
30 typedef test_less
<MoveOnly
> C
;
31 typedef test_allocator
<V
> A
;
32 typedef std::multiset
<MoveOnly
, C
, A
> M
;
33 typedef std::move_iterator
<V
*> I
;
46 M
m1(I(a1
), I(a1
+sizeof(a1
)/sizeof(a1
[0])), C(5), A(7));
59 M
m2(I(a2
), I(a2
+sizeof(a2
)/sizeof(a2
[0])), C(5), A(7));
63 assert(m3
.get_allocator() == A(7));
64 assert(m3
.key_comp() == C(5));
69 typedef test_less
<MoveOnly
> C
;
70 typedef test_allocator
<V
> A
;
71 typedef std::multiset
<MoveOnly
, C
, A
> M
;
72 typedef std::move_iterator
<V
*> I
;
85 M
m1(I(a1
), I(a1
+sizeof(a1
)/sizeof(a1
[0])), C(5), A(7));
98 M
m2(I(a2
), I(a2
+sizeof(a2
)/sizeof(a2
[0])), C(5), A(7));
102 assert(m3
.get_allocator() == A(5));
103 assert(m3
.key_comp() == C(5));
104 LIBCPP_ASSERT(m1
.empty());
108 typedef test_less
<MoveOnly
> C
;
109 typedef other_allocator
<V
> A
;
110 typedef std::multiset
<MoveOnly
, C
, A
> M
;
111 typedef std::move_iterator
<V
*> I
;
124 M
m1(I(a1
), I(a1
+sizeof(a1
)/sizeof(a1
[0])), C(5), A(7));
137 M
m2(I(a2
), I(a2
+sizeof(a2
)/sizeof(a2
[0])), C(5), A(7));
141 assert(m3
.get_allocator() == A(7));
142 assert(m3
.key_comp() == C(5));
147 typedef test_less
<MoveOnly
> C
;
148 typedef min_allocator
<V
> A
;
149 typedef std::multiset
<MoveOnly
, C
, A
> M
;
150 typedef std::move_iterator
<V
*> I
;
163 M
m1(I(a1
), I(a1
+sizeof(a1
)/sizeof(a1
[0])), C(5), A());
176 M
m2(I(a2
), I(a2
+sizeof(a2
)/sizeof(a2
[0])), C(5), A());
180 assert(m3
.get_allocator() == A());
181 assert(m3
.key_comp() == C(5));