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 //===----------------------------------------------------------------------===//
13 // multimap& operator=(const multimap& m);
18 #include "test_macros.h"
19 #include "../../../test_compare.h"
20 #include "test_allocator.h"
21 #include "min_allocator.h"
26 typedef std::pair
<const int, double> V
;
39 typedef test_less
<int> C
;
40 typedef test_allocator
<V
> A
;
41 std::multimap
<int, double, C
, A
> mo(ar
, ar
+sizeof(ar
)/sizeof(ar
[0]), C(5), A(2));
42 std::multimap
<int, double, C
, A
> m(ar
, ar
+sizeof(ar
)/sizeof(ar
[0])/2, C(3), A(7));
45 assert(m
.get_allocator() == A(7));
46 assert(m
.key_comp() == C(5));
48 assert(mo
.get_allocator() == A(2));
49 assert(mo
.key_comp() == C(5));
52 typedef std::pair
<const int, double> V
;
65 std::multimap
<int, double> m(ar
, ar
+sizeof(ar
)/sizeof(ar
[0]));
66 std::multimap
<int, double> *p
= &m
;
68 assert(m
.size() == sizeof(ar
)/sizeof(ar
[0]));
69 assert(std::equal(m
.begin(), m
.end(), ar
));
72 typedef std::pair
<const int, double> V
;
85 typedef test_less
<int> C
;
86 typedef other_allocator
<V
> A
;
87 std::multimap
<int, double, C
, A
> mo(ar
, ar
+sizeof(ar
)/sizeof(ar
[0]), C(5), A(2));
88 std::multimap
<int, double, C
, A
> m(ar
, ar
+sizeof(ar
)/sizeof(ar
[0])/2, C(3), A(7));
91 assert(m
.get_allocator() == A(2));
92 assert(m
.key_comp() == C(5));
94 assert(mo
.get_allocator() == A(2));
95 assert(mo
.key_comp() == C(5));
97 #if TEST_STD_VER >= 11
99 typedef std::pair
<const int, double> V
;
112 typedef test_less
<int> C
;
113 typedef min_allocator
<V
> A
;
114 std::multimap
<int, double, C
, A
> mo(ar
, ar
+sizeof(ar
)/sizeof(ar
[0]), C(5), A());
115 std::multimap
<int, double, C
, A
> m(ar
, ar
+sizeof(ar
)/sizeof(ar
[0])/2, C(3), A());
118 assert(m
.get_allocator() == A());
119 assert(m
.key_comp() == C(5));
121 assert(mo
.get_allocator() == A());
122 assert(mo
.key_comp() == C(5));