Fixed support for allocators with explicit copy constructors (#234)

* added tests for explicit allocators

* made explicit_alloc_ctor_tests work
by adhering to the principle that classes templated with Allocator should accept exactly Allocator objects

* removed TMP machinery older compilers choke about

* initialized variables

* updated release notes

* fixed PR number
This commit is contained in:
joaquintides
2024-02-17 18:58:48 +01:00
committed by GitHub
parent 7692065552
commit 15cfef6967
11 changed files with 215 additions and 32 deletions
+11 -6
View File
@@ -1,6 +1,7 @@
// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
// Copyright (C) 2005-2011 Daniel James.
// 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)
@@ -158,7 +159,7 @@ namespace boost {
allocator_type get_allocator() const noexcept
{
return table_.node_alloc();
return allocator_type(table_.node_alloc());
}
// // iterators
@@ -254,12 +255,15 @@ namespace boost {
node_type extract(const_iterator position)
{
return node_type(
table_.extract_by_iterator_unique(position), table_.node_alloc());
table_.extract_by_iterator_unique(position),
allocator_type(table_.node_alloc()));
}
node_type extract(const key_type& k)
{
return node_type(table_.extract_by_key_impl(k), table_.node_alloc());
return node_type(
table_.extract_by_key_impl(k),
allocator_type(table_.node_alloc()));
}
template <class Key>
@@ -268,8 +272,9 @@ namespace boost {
node_type>::type
extract(Key&& k)
{
return node_type(table_.extract_by_key_impl(std::forward<Key>(k)),
table_.node_alloc());
return node_type(
table_.extract_by_key_impl(std::forward<Key>(k)),
allocator_type(table_.node_alloc()));
}
insert_return_type insert(node_type&& np)
@@ -806,7 +811,7 @@ namespace boost {
allocator_type get_allocator() const noexcept
{
return table_.node_alloc();
return allocator_type(table_.node_alloc());
}
// iterators