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
@@ -1,4 +1,5 @@
// Copyright (C) 2022-2023 Christian Mazakas
// Copyright (C) 2024 Joaquin M Lopez Munoz
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -202,6 +203,13 @@ namespace boost {
return *this;
}
unordered_flat_map& operator=(std::initializer_list<value_type> il)
{
this->clear();
this->insert(il.begin(), il.end());
return *this;
}
allocator_type get_allocator() const noexcept
{
return table_.get_allocator();
@@ -1,4 +1,5 @@
// Copyright (C) 2022-2023 Christian Mazakas
// Copyright (C) 2024 Joaquin M Lopez Munoz
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -198,6 +199,13 @@ namespace boost {
return *this;
}
unordered_flat_set& operator=(std::initializer_list<value_type> il)
{
this->clear();
this->insert(il.begin(), il.end());
return *this;
}
allocator_type get_allocator() const noexcept
{
return table_.get_allocator();
@@ -210,6 +210,13 @@ namespace boost {
return *this;
}
unordered_node_map& operator=(std::initializer_list<value_type> il)
{
this->clear();
this->insert(il.begin(), il.end());
return *this;
}
allocator_type get_allocator() const noexcept
{
return table_.get_allocator();
@@ -208,6 +208,13 @@ namespace boost {
return *this;
}
unordered_node_set& operator=(std::initializer_list<value_type> il)
{
this->clear();
this->insert(il.begin(), il.end());
return *this;
}
allocator_type get_allocator() const noexcept
{
return table_.get_allocator();