Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions include/boost/unordered/concurrent_flat_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*
* Copyright 2023 Christian Mazakas.
* Copyright 2023-2024 Joaquin M Lopez Munoz.
* Copyright 2026 Braden Ganetsky
* 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)
Expand Down Expand Up @@ -189,11 +190,30 @@ namespace boost {
{
}

template <class U,
typename std::enable_if<
// Ensure we match exactly `unordered_flat_map&&`.
// Any lvalue references to `unordered_flat_map` are not supported.
std::is_same<U,
unordered_flat_map<Key, T, Hash, Pred, Allocator> >::value,
int>::type = 0>
concurrent_flat_map(U&& other) : table_(std::move(other.table_))
{
}

template <bool avoid_explicit_instantiation = true>
concurrent_flat_map(
unordered_flat_map<Key, T, Hash, Pred, Allocator>&& other)
: table_(std::move(other.table_))
template <class U,
typename std::enable_if<
// Ensure we don't match any cvref-qualified `unordered_flat_map&&`,
!detail::is_similar<U,
unordered_flat_map<Key, T, Hash, Pred, Allocator> >::value
// but we do match anything convertible to `unordered_flat_map`.
&& std::is_convertible<U&&,
unordered_flat_map<Key, T, Hash, Pred, Allocator> >::value,
int>::type = 0>
concurrent_flat_map(U&& other)
: concurrent_flat_map(
unordered_flat_map<Key, T, Hash, Pred, Allocator>(
std::forward<U>(other)))
{
}

Expand Down
27 changes: 23 additions & 4 deletions include/boost/unordered/concurrent_flat_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*
* Copyright 2023 Christian Mazakas.
* Copyright 2023-2024 Joaquin M Lopez Munoz.
* Copyright 2026 Braden Ganetsky
* 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)
Expand Down Expand Up @@ -186,11 +187,29 @@ namespace boost {
{
}

template <class U,
typename std::enable_if<
// Ensure we match exactly `unordered_flat_set&&`.
// Any lvalue references to `unordered_flat_set` are not supported.
std::is_same<U,
unordered_flat_set<Key, Hash, Pred, Allocator> >::value,
int>::type = 0>
concurrent_flat_set(U&& other) : table_(std::move(other.table_))
{
}

template <bool avoid_explicit_instantiation = true>
concurrent_flat_set(
unordered_flat_set<Key, Hash, Pred, Allocator>&& other)
: table_(std::move(other.table_))
template <class U,
typename std::enable_if<
// Ensure we don't match any cvref-qualified `unordered_flat_set&&`,
!detail::is_similar<U,
unordered_flat_set<Key, Hash, Pred, Allocator> >::value
// but we do match anything convertible to `unordered_flat_set`.
&& std::is_convertible<U&&,
unordered_flat_set<Key, Hash, Pred, Allocator> >::value,
int>::type = 0>
concurrent_flat_set(U&& other)
: concurrent_flat_set(unordered_flat_set<Key, Hash, Pred, Allocator>(
std::forward<U>(other)))
{
}

Expand Down
29 changes: 25 additions & 4 deletions include/boost/unordered/concurrent_node_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*
* Copyright 2023 Christian Mazakas.
* Copyright 2023-2024 Joaquin M Lopez Munoz.
* Copyright 2026 Braden Ganetsky
* 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)
Expand Down Expand Up @@ -197,10 +198,30 @@ namespace boost {
{
}

template <bool avoid_explicit_instantiation = true>
concurrent_node_map(
unordered_node_map<Key, T, Hash, Pred, Allocator>&& other)
: table_(std::move(other.table_))
template <class U,
typename std::enable_if<
// Ensure we match exactly `unordered_node_map&&`.
// Any lvalue references to `unordered_node_map` are not supported.
std::is_same<U,
unordered_node_map<Key, T, Hash, Pred, Allocator> >::value,
int>::type = 0>
concurrent_node_map(U&& other) : table_(std::move(other.table_))
{
}

template <class U,
typename std::enable_if<
// Ensure we don't match any cvref-qualified `unordered_node_map&&`,
!detail::is_similar<U,
unordered_node_map<Key, T, Hash, Pred, Allocator> >::value
// but we do match anything convertible to `unordered_node_map`.
&& std::is_convertible<U&&,
unordered_node_map<Key, T, Hash, Pred, Allocator> >::value,
int>::type = 0>
concurrent_node_map(U&& other)
: concurrent_node_map(
unordered_node_map<Key, T, Hash, Pred, Allocator>(
std::forward<U>(other)))
{
}

Expand Down
28 changes: 24 additions & 4 deletions include/boost/unordered/concurrent_node_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*
* Copyright 2023 Christian Mazakas.
* Copyright 2023-2024 Joaquin M Lopez Munoz.
* Copyright 2026 Braden Ganetsky
* 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)
Expand Down Expand Up @@ -194,10 +195,29 @@ namespace boost {
{
}

template <bool avoid_explicit_instantiation = true>
concurrent_node_set(
unordered_node_set<Key, Hash, Pred, Allocator>&& other)
: table_(std::move(other.table_))
template <class U,
typename std::enable_if<
// Ensure we match exactly `unordered_node_set&&`.
// Any lvalue references to `unordered_node_set` are not supported.
std::is_same<U,
unordered_node_set<Key, Hash, Pred, Allocator> >::value,
int>::type = 0>
concurrent_node_set(U&& other) : table_(std::move(other.table_))
{
}

template <class U,
typename std::enable_if<
// Ensure we don't match any cvref-qualified `unordered_node_set&&`,
!detail::is_similar<U,
unordered_node_set<Key, Hash, Pred, Allocator> >::value
// but we do match anything convertible to `unordered_node_set`.
&& std::is_convertible<U&&,
unordered_node_set<Key, Hash, Pred, Allocator> >::value,
int>::type = 0>
concurrent_node_set(U&& other)
: concurrent_node_set(unordered_node_set<Key, Hash, Pred, Allocator>(
std::forward<U>(other)))
{
}

Expand Down
29 changes: 25 additions & 4 deletions include/boost/unordered/unordered_flat_map.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (C) 2022-2023 Christian Mazakas
// Copyright (C) 2024-2025 Joaquin M Lopez Munoz
// Copyright (C) 2026 Braden Ganetsky
// 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)

Expand Down Expand Up @@ -182,10 +183,30 @@ namespace boost {
{
}

template <bool avoid_explicit_instantiation = true>
unordered_flat_map(
concurrent_flat_map<Key, T, Hash, KeyEqual, Allocator>&& other)
: table_(std::move(other.table_))
template <class U,
typename std::enable_if<
// Ensure we match exactly `concurrent_flat_map&&`.
// Any lvalue references to `concurrent_flat_map` are not supported.
std::is_same<U,
concurrent_flat_map<Key, T, Hash, KeyEqual, Allocator> >::value,
int>::type = 0>
unordered_flat_map(U&& other) : table_(std::move(other.table_))
{
}

template <class U,
typename std::enable_if<
// Ensure we don't match any cvref-qualified `concurrent_flat_map&&`,
!detail::is_similar<U,
concurrent_flat_map<Key, T, Hash, KeyEqual, Allocator> >::value
// but we do match anything convertible to `concurrent_flat_map`.
&& std::is_convertible<U&&, concurrent_flat_map<Key, T, Hash,
KeyEqual, Allocator> >::value,
int>::type = 0>
unordered_flat_map(U&& other)
: unordered_flat_map(
concurrent_flat_map<Key, T, Hash, KeyEqual, Allocator>(
std::forward<U>(other)))
{
}

Expand Down
29 changes: 25 additions & 4 deletions include/boost/unordered/unordered_flat_set.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (C) 2022-2023 Christian Mazakas
// Copyright (C) 2024-2025 Joaquin M Lopez Munoz
// Copyright (C) 2026 Braden Ganetsky
// 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)

Expand Down Expand Up @@ -178,10 +179,30 @@ namespace boost {
{
}

template <bool avoid_explicit_instantiation = true>
unordered_flat_set(
concurrent_flat_set<Key, Hash, KeyEqual, Allocator>&& other)
: table_(std::move(other.table_))
template <class U,
typename std::enable_if<
// Ensure we match exactly `concurrent_flat_set&&`.
// Any lvalue references to `concurrent_flat_set` are not supported.
std::is_same<U,
concurrent_flat_set<Key, Hash, KeyEqual, Allocator> >::value,
int>::type = 0>
unordered_flat_set(U&& other) : table_(std::move(other.table_))
{
}

template <class U,
typename std::enable_if<
// Ensure we don't match any cvref-qualified `concurrent_flat_set&&`,
!detail::is_similar<U,
concurrent_flat_set<Key, Hash, KeyEqual, Allocator> >::value
// but we do match anything convertible to `concurrent_flat_set`.
&& std::is_convertible<U&&,
concurrent_flat_set<Key, Hash, KeyEqual, Allocator> >::value,
int>::type = 0>
unordered_flat_set(U&& other)
: unordered_flat_set(
concurrent_flat_set<Key, Hash, KeyEqual, Allocator>(
std::forward<U>(other)))
{
}

Expand Down
29 changes: 25 additions & 4 deletions include/boost/unordered/unordered_node_map.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (C) 2022-2023 Christian Mazakas
// Copyright (C) 2024-2025 Joaquin M Lopez Munoz
// Copyright (C) 2026 Braden Ganetsky
// 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)

Expand Down Expand Up @@ -189,10 +190,30 @@ namespace boost {
{
}

template <bool avoid_explicit_instantiation = true>
unordered_node_map(
concurrent_node_map<Key, T, Hash, KeyEqual, Allocator>&& other)
: table_(std::move(other.table_))
template <class U,
typename std::enable_if<
// Ensure we match exactly `concurrent_node_map&&`.
// Any lvalue references to `concurrent_node_map` are not supported.
std::is_same<U,
concurrent_node_map<Key, T, Hash, KeyEqual, Allocator> >::value,
int>::type = 0>
unordered_node_map(U&& other) : table_(std::move(other.table_))
{
}

template <class U,
typename std::enable_if<
// Ensure we don't match any cvref-qualified `concurrent_node_map&&`,
!detail::is_similar<U,
concurrent_node_map<Key, T, Hash, KeyEqual, Allocator> >::value
// but we do match anything convertible to `concurrent_node_map`.
&& std::is_convertible<U&&, concurrent_node_map<Key, T, Hash,
KeyEqual, Allocator> >::value,
int>::type = 0>
unordered_node_map(U&& other)
: unordered_node_map(
concurrent_node_map<Key, T, Hash, KeyEqual, Allocator>(
std::forward<U>(other)))
{
}

Expand Down
29 changes: 25 additions & 4 deletions include/boost/unordered/unordered_node_set.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (C) 2022-2023 Christian Mazakas
// Copyright (C) 2024-2025 Joaquin M Lopez Munoz
// Copyright (C) 2026 Braden Ganetsky
// 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)

Expand Down Expand Up @@ -187,10 +188,30 @@ namespace boost {
{
}

template <bool avoid_explicit_instantiation = true>
unordered_node_set(
concurrent_node_set<Key, Hash, KeyEqual, Allocator>&& other)
: table_(std::move(other.table_))
template <class U,
typename std::enable_if<
// Ensure we match exactly `concurrent_node_set&&`.
// Any lvalue references to `concurrent_node_set` are not supported.
std::is_same<U,
concurrent_node_set<Key, Hash, KeyEqual, Allocator> >::value,
int>::type = 0>
unordered_node_set(U&& other) : table_(std::move(other.table_))
{
}

template <class U,
typename std::enable_if<
// Ensure we don't match any cvref-qualified `concurrent_node_set&&`,
!detail::is_similar<U,
concurrent_node_set<Key, Hash, KeyEqual, Allocator> >::value
// but we do match anything convertible to `concurrent_node_set`.
&& std::is_convertible<U&&,
concurrent_node_set<Key, Hash, KeyEqual, Allocator> >::value,
int>::type = 0>
unordered_node_set(U&& other)
: unordered_node_set(
concurrent_node_set<Key, Hash, KeyEqual, Allocator>(
std::forward<U>(other)))
{
}

Expand Down
9 changes: 9 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,13 @@ cfoa_tests(SOURCES cfoa/rw_spinlock_test6.cpp)
cfoa_tests(SOURCES cfoa/rw_spinlock_test7.cpp)
cfoa_tests(SOURCES cfoa/rw_spinlock_test8.cpp)

# Compile tests

fca_tests(TYPE compile NAME explicit_instantiation_tests SOURCES unordered/explicit_instantiation_tests.cpp)
foa_tests(TYPE compile NAME explicit_instantiation_tests SOURCES unordered/explicit_instantiation_tests.cpp)
cfoa_tests(TYPE compile NAME explicit_instantiation_tests SOURCES cfoa/explicit_instantiation_tests.cpp)

foa_tests(TYPE compile NAME conversion_operator_tests SOURCES unordered/conversion_operator_tests.cpp)
cfoa_tests(TYPE compile NAME conversion_operator_tests SOURCES cfoa/conversion_operator_tests.cpp)

endif()
3 changes: 3 additions & 0 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ compile unordered/explicit_instantiation_tests.cpp :
compile unordered/explicit_instantiation_tests.cpp : <define>BOOST_UNORDERED_FOA_TESTS : foa_explicit_instantiation_tests ;
compile cfoa/explicit_instantiation_tests.cpp : : cfoa_explicit_instantiation_tests ;

compile unordered/conversion_operator_tests.cpp : <define>BOOST_UNORDERED_FOA_TESTS : foa_conversion_operator_tests ;
compile cfoa/conversion_operator_tests.cpp : : cfoa_conversion_operator_tests ;

local FCA_EXCEPTION_TESTS =
constructor_exception_tests
copy_exception_tests
Expand Down
Loading
Loading