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 // multimap& operator=(multimap&& m);
20 #include "test_macros.h"
22 #include "../../../test_compare.h"
23 #include "test_allocator.h"
24 #include "min_allocator.h"
29 typedef std::pair
<MoveOnly
, MoveOnly
> V
;
30 typedef std::pair
<const MoveOnly
, MoveOnly
> VC
;
31 typedef test_less
<MoveOnly
> C
;
32 typedef test_allocator
<VC
> A
;
33 typedef std::multimap
<MoveOnly
, MoveOnly
, C
, A
> M
;
34 typedef std::move_iterator
<V
*> I
;
47 M
m1(I(a1
), I(a1
+sizeof(a1
)/sizeof(a1
[0])), C(5), A(7));
60 M
m2(I(a2
), I(a2
+sizeof(a2
)/sizeof(a2
[0])), C(5), A(7));
64 assert(m3
.get_allocator() == A(7));
65 assert(m3
.key_comp() == C(5));
69 typedef std::pair
<MoveOnly
, MoveOnly
> V
;
70 typedef std::pair
<const MoveOnly
, MoveOnly
> VC
;
71 typedef test_less
<MoveOnly
> C
;
72 typedef test_allocator
<VC
> A
;
73 typedef std::multimap
<MoveOnly
, MoveOnly
, C
, A
> M
;
74 typedef std::move_iterator
<V
*> I
;
87 M
m1(I(a1
), I(a1
+sizeof(a1
)/sizeof(a1
[0])), C(5), A(7));
100 M
m2(I(a2
), I(a2
+sizeof(a2
)/sizeof(a2
[0])), C(5), A(7));
104 assert(m3
.get_allocator() == A(5));
105 assert(m3
.key_comp() == C(5));
106 LIBCPP_ASSERT(m1
.empty());
109 typedef std::pair
<MoveOnly
, MoveOnly
> V
;
110 typedef std::pair
<const MoveOnly
, MoveOnly
> VC
;
111 typedef test_less
<MoveOnly
> C
;
112 typedef other_allocator
<VC
> A
;
113 typedef std::multimap
<MoveOnly
, MoveOnly
, C
, A
> M
;
114 typedef std::move_iterator
<V
*> I
;
127 M
m1(I(a1
), I(a1
+sizeof(a1
)/sizeof(a1
[0])), C(5), A(7));
140 M
m2(I(a2
), I(a2
+sizeof(a2
)/sizeof(a2
[0])), C(5), A(7));
144 assert(m3
.get_allocator() == A(7));
145 assert(m3
.key_comp() == C(5));
149 typedef std::pair
<MoveOnly
, MoveOnly
> V
;
150 typedef std::pair
<const MoveOnly
, MoveOnly
> VC
;
151 typedef test_less
<MoveOnly
> C
;
152 typedef min_allocator
<VC
> A
;
153 typedef std::multimap
<MoveOnly
, MoveOnly
, C
, A
> M
;
154 typedef std::move_iterator
<V
*> I
;
167 M
m1(I(a1
), I(a1
+sizeof(a1
)/sizeof(a1
[0])), C(5), A());
180 M
m2(I(a2
), I(a2
+sizeof(a2
)/sizeof(a2
[0])), C(5), A());
184 assert(m3
.get_allocator() == A());
185 assert(m3
.key_comp() == C(5));