Fixed std::initializer_list assignment issues for open-addressing containers (#277)

* fixed #276

* used range insert, stylistic this->

* assigned non-empty std::initializer_lists
This commit is contained in:
joaquintides
2024-09-02 18:56:13 +02:00
committed by GitHub
parent 21937249c4
commit cd9a592f00
10 changed files with 185 additions and 33 deletions
+25
View File
@@ -7,12 +7,16 @@
#include "../helpers/unordered.hpp"
#include "../helpers/test.hpp"
#include "../helpers/replace_allocator.hpp"
#include "../objects/test.hpp"
#include "../objects/cxx11_allocator.hpp"
#include "../objects/non_default_ctble_allocator.hpp"
#include "../helpers/random_values.hpp"
#include "../helpers/tracker.hpp"
#include "../helpers/equivalent.hpp"
#include <vector>
#if defined(BOOST_MSVC)
#pragma warning(disable : 4127) // conditional expression is constant
#endif
@@ -288,6 +292,27 @@ namespace assign_tests {
}
#endif
}
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "gh276\n";
{
// https://github.com/boostorg/unordered/issues/276
using value_type = typename T::value_type;
using replaced_allocator_container = test::replace_allocator<
T, test::non_default_ctble_allocator<int> >;
using replaced_allocator_type =
typename replaced_allocator_container::allocator_type;
test::random_values<T> v(4, generator);
std::vector<value_type> vv(v.begin(), v.end());
replaced_allocator_container
x(replaced_allocator_type(0)),
y(vv.begin(), vv.begin() + 4, replaced_allocator_type(0));
x = {vv[0], vv[1], vv[2], vv[3]};
BOOST_TEST(x == y);
}
}
using test::default_generator;