// constructors
using _Impl::_Impl;
+ // operator=(initializer_list<value_type>)
+ // Although this also brings in the base move/copy assignment operators,
+ // they will be hidden by our synthesized ones.
+ using _Impl::operator=;
+
// iterators
using _Impl::begin;
using _Impl::end;
// constructors
using _Impl::_Impl;
+ // operator=(initializer_list<value_type>)
+ // Although this also brings in the base move/copy assignment operators,
+ // they will be hidden by our synthesized ones.
+ using _Impl::operator=;
+
// iterators
using _Impl::begin;
using _Impl::end;
// constructors
using _Impl::_Impl;
+ // operator=(initializer_list<value_type>)
+ // Although this also brings in the base move/copy assignment operators,
+ // they will be hidden by our synthesized ones.
+ using _Impl::operator=;
+
// iterators
using _Impl::begin;
using _Impl::end;
// constructors
using _Impl::_Impl;
+ // operator=(initializer_list<value_type>)
+ // Although this also brings in the base move/copy assignment operators,
+ // they will be hidden by our synthesized ones.
+ using _Impl::operator=;
+
// iterators
using _Impl::begin;
using _Impl::end;
}
// Verify invariant preservation upon throwing move assignment.
- source.clear();
- source.insert({{1, 100}, {2, 200}});
+ source = {{1, 100}, {2, 200}};
flat_map target;
target.insert({{3, 300}, {4, 400}});
try
}
// Verify invariant preservation upon throwing swap.
- source.clear();
- source.insert({{1, 100}, {2, 200}});
- target.clear();
- target.insert({{3, 300}, {4, 400}});
+ source = {{1, 100}, {2, 200}};
+ target = {{3, 300}, {4, 400}};
try
{
source.swap(target);
VERIFY( std::ranges::equal(m.values(), (int[]){100, 200, 300}) );
}
+void
+test13()
+{
+ // Verify usability of flat_map::operator=(initializer_list).
+ throwing_vector<int>::throw_on_move = true;
+ std::flat_map<int, int, std::less<int>, throwing_vector<int>> s;
+ std::initializer_list<std::pair<int, int>> il = {{2, 1}, {3, 2}, {1, 3}};
+ s = il;
+ VERIFY( std::ranges::equal(s.keys(), (int[]){1, 2, 3}) );
+ VERIFY( std::ranges::equal(s.values(), (int[]){3, 1, 2}) );
+}
+
void
test()
{
test11<std::vector, throwing_vector>();
test11<throwing_vector, std::vector>();
test12();
+ test13();
}
constexpr
#endif
// test11() is non-constexpr
test12();
+ // test13() is non-constexpr
return true;
}
}
// Verify invariant preservation upon throwing move assignment.
- source.clear();
- source.insert({{1, 100}, {2, 200}});
+ source = {{1, 100}, {2, 200}};
flat_multimap target;
target.insert({{3, 300}, {4, 400}});
try
}
// Verify invariant preservation upon throwing swap.
- source.clear();
- source.insert({{1, 100}, {2, 200}});
- target.clear();
- target.insert({{3, 300}, {4, 400}});
+ source = {{1, 100}, {2, 200}};
+ target = {{3, 300}, {4, 400}};
try
{
source.swap(target);
VERIFY( std::ranges::equal(m.values(), (int[]){100, 200, 300}) );
}
+void
+test12()
+{
+ // Verify usability of flat_multimap::operator=(initializer_list).
+ throwing_vector<int>::throw_on_move = true;
+ std::flat_multimap<int, int, std::less<int>, throwing_vector<int>> s;
+ std::initializer_list<std::pair<int, int>> il = {{2, 1}, {3, 2}, {1, 3}};
+ s = il;
+ VERIFY( std::ranges::equal(s.keys(), (int[]){1, 2, 3}) );
+ VERIFY( std::ranges::equal(s.values(), (int[]){3, 1, 2}) );
+}
+
void
test()
{
test10<std::vector, throwing_vector>();
test10<throwing_vector, std::vector>();
test11();
+ test12();
}
constexpr
test09();
// test10() is non-constexpr
test11();
+ // test12() is non-constexpr
return true;
}
throw std::runtime_error("move assign");
return *this;
}
+
+ using std::vector<int>::operator=;
};
void
}
// Verify invariant preservation upon throwing move assignment.
- source.clear();
- source.insert({1, 2});
+ source = {1, 2};
flat_multiset target = {3, 4};
try
{
}
// Verify invariant preservation upon throwing swap.
- source.clear();
- source.insert({1, 2});
- target.clear();
- target.insert({3, 4});
+ source = {1, 2};
+ target = {3, 4};
try
{
source.swap(target);
VERIFY( std::ranges::equal(m, (int[]){1, 2, 3}) );
}
+void
+test12()
+{
+ // Verify usability of flat_multiset::operator=(initializer_list).
+ throwing_vector<int>::throw_on_move = true;
+ std::flat_multiset<int, std::less<int>, throwing_vector<int>> s;
+ std::initializer_list<int> il = {2, 3, 1};
+ s = il;
+ VERIFY( std::ranges::equal(s, (int[]){1, 2, 3}) );
+}
+
void
test()
{
test09();
test10();
test11();
+ test12();
}
constexpr
test09();
// test10() is non-constexpr
test11();
+ // test12() is non-constexpr
return true;
}
throw std::runtime_error("move assign");
return *this;
}
+
+ using std::vector<int>::operator=;
};
void
}
// Verify invariant preservation upon throwing move assignment.
- source.clear();
- source.insert({1, 2});
+ source = {1, 2};
flat_set target = {3, 4};
try
{
}
// Verify invariant preservation upon throwing swap.
- source.clear();
- source.insert({1, 2});
- target.clear();
- target.insert({3, 4});
+ source = {1, 2};
+ target = {3, 4};
try
{
source.swap(target);
VERIFY( std::ranges::equal(m, (int[]){1, 2, 3}) );
}
+void
+test12()
+{
+ // Verify usability of flat_set::operator=(initializer_list).
+ throwing_vector<int>::throw_on_move = true;
+ std::flat_set<int, std::less<int>, throwing_vector<int>> s;
+ std::initializer_list<int> il = {2, 3, 1};
+ s = il;
+ VERIFY( std::ranges::equal(s, (int[]){1, 2, 3}) );
+}
+
void
test()
{
test09();
test10();
test11();
+ test12();
}
constexpr
test09();
// test10() is non-constexpr
test11();
+ // test12() is non-constexpr
return true;
}