2222#include < functional>
2323#include < type_traits>
2424#include < vector>
25+ #include < ranges>
2526
2627#include " test_macros.h"
2728#include " min_allocator.h"
@@ -77,26 +78,26 @@ void test() {
7778 static_assert (!std::is_constructible_v<M, std::initializer_list<const int >, std::allocator<int >>);
7879 }
7980
80- int expected[] = {1 , 2 , 3 , 5 };
81+ int expected[] = {1 , 2 , 2 , 3 , 3 , 5 };
8182 {
8283 // flat_multiset(initializer_list<value_type>);
8384 using M = std::flat_multiset<int >;
8485 std::initializer_list<int > il = {5 , 2 , 2 , 3 , 1 , 3 };
8586 M m (il);
86- assert (std::equal (m. begin (), m. end (), expected, expected + 4 ));
87+ assert (std::ranges:: equal (m, expected));
8788 }
8889 {
8990 // flat_multiset(initializer_list<value_type>);
9091 // explicit(false)
9192 using M = std::flat_multiset<int >;
9293 M m = {5 , 2 , 2 , 3 , 1 , 3 };
93- assert (std::equal (m. begin (), m. end (), expected, expected + 4 ));
94+ assert (std::ranges:: equal (m, expected));
9495 }
9596 {
9697 // flat_multiset(initializer_list<value_type>);
9798 using M = std::flat_multiset<int , std::greater<int >, std::deque<int , min_allocator<int >>>;
9899 M m = {5 , 2 , 2 , 3 , 1 , 3 };
99- assert (std::equal (m. rbegin (), m. rend (), expected, expected + 4 ));
100+ assert (std::ranges:: equal (m, expected | std::views::reverse ));
100101 }
101102 {
102103 using A = explicit_allocator<int >;
@@ -105,7 +106,7 @@ void test() {
105106 // different comparator
106107 using M = std::flat_multiset<int , DefaultCtableComp, std::vector<int , A>>;
107108 M m = {1 , 2 , 3 };
108- assert (m.size () == 1 );
109+ assert (m.size () == 3 );
109110 LIBCPP_ASSERT (*m.begin () == 1 );
110111 assert (m.key_comp ().default_constructed_ );
111112 }
@@ -114,15 +115,15 @@ void test() {
114115 using M = std::flat_multiset<int , std::greater<int >, std::deque<int , A>>;
115116 A a;
116117 M m ({5 , 2 , 2 , 3 , 1 , 3 }, a);
117- assert (std::equal (m. rbegin (), m. rend (), expected, expected + 4 ));
118+ assert (std::ranges:: equal (m, expected | std::views::reverse ));
118119 }
119120 }
120121 {
121122 // flat_multiset(initializer_list<value_type>, const key_compare&);
122123 using C = test_less<int >;
123124 using M = std::flat_multiset<int , C>;
124125 auto m = M ({5 , 2 , 2 , 3 , 1 , 3 }, C (10 ));
125- assert (std::equal (m. begin (), m. end (), expected, expected + 4 ));
126+ assert (std::ranges:: equal (m, expected));
126127 assert (m.key_comp () == C (10 ));
127128
128129 // explicit(false)
@@ -134,8 +135,8 @@ void test() {
134135 // flat_multiset(initializer_list<value_type>, const key_compare&);
135136 // Sorting uses the comparator that was passed in
136137 using M = std::flat_multiset<int , std::function<bool (int , int )>, std::deque<int , min_allocator<int >>>;
137- auto m = M ({5 , 2 , 2 , 1 , 3 , 1 }, std::greater<int >());
138- assert (std::equal (m. rbegin (), m. rend (), expected, expected + 4 ));
138+ auto m = M ({5 , 2 , 2 , 1 , 3 , 3 }, std::greater<int >());
139+ assert (std::ranges:: equal (m, expected | std::views::reverse ));
139140 assert (m.key_comp ()(2 , 1 ) == true );
140141 }
141142 {
@@ -144,7 +145,7 @@ void test() {
144145 using M = std::flat_multiset<int , std::greater<int >, std::deque<int , A>>;
145146 A a;
146147 M m ({5 , 2 , 2 , 3 , 1 , 3 }, {}, a);
147- assert (std::equal (m. rbegin (), m. rend (), expected, expected + 4 ));
148+ assert (std::ranges:: equal (m, expected | std::views::reverse ));
148149 }
149150}
150151
0 commit comments