diff --git a/include/boost/unordered/concurrent_flat_map.hpp b/include/boost/unordered/concurrent_flat_map.hpp index 6b54ce5e3..7ba2286a0 100644 --- a/include/boost/unordered/concurrent_flat_map.hpp +++ b/include/boost/unordered/concurrent_flat_map.hpp @@ -2,6 +2,7 @@ * * Copyright 2023 Christian Mazakas. * Copyright 2023-2026 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) @@ -189,10 +190,10 @@ namespace boost { { } - - template + template ::value, int>::type = 0> concurrent_flat_map( - unordered_flat_map&& other) + unordered_flat_map&& other) : table_(std::move(other.table_)) { } diff --git a/include/boost/unordered/concurrent_flat_set.hpp b/include/boost/unordered/concurrent_flat_set.hpp index 54cb6c9fc..162c4c283 100644 --- a/include/boost/unordered/concurrent_flat_set.hpp +++ b/include/boost/unordered/concurrent_flat_set.hpp @@ -2,6 +2,7 @@ * * Copyright 2023 Christian Mazakas. * Copyright 2023-2026 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) @@ -186,10 +187,10 @@ namespace boost { { } - - template + template ::value, int>::type = 0> concurrent_flat_set( - unordered_flat_set&& other) + unordered_flat_set&& other) : table_(std::move(other.table_)) { } diff --git a/include/boost/unordered/concurrent_node_map.hpp b/include/boost/unordered/concurrent_node_map.hpp index e75f96591..50f667bc3 100644 --- a/include/boost/unordered/concurrent_node_map.hpp +++ b/include/boost/unordered/concurrent_node_map.hpp @@ -2,6 +2,7 @@ * * Copyright 2023 Christian Mazakas. * Copyright 2023-2026 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) @@ -197,9 +198,10 @@ namespace boost { { } - template + template ::value, int>::type = 0> concurrent_node_map( - unordered_node_map&& other) + unordered_node_map&& other) : table_(std::move(other.table_)) { } diff --git a/include/boost/unordered/concurrent_node_set.hpp b/include/boost/unordered/concurrent_node_set.hpp index 71818f967..3cdcd947f 100644 --- a/include/boost/unordered/concurrent_node_set.hpp +++ b/include/boost/unordered/concurrent_node_set.hpp @@ -2,6 +2,7 @@ * * Copyright 2023 Christian Mazakas. * Copyright 2023-2026 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) @@ -194,9 +195,10 @@ namespace boost { { } - template + template ::value, int>::type = 0> concurrent_node_set( - unordered_node_set&& other) + unordered_node_set&& other) : table_(std::move(other.table_)) { } diff --git a/include/boost/unordered/unordered_flat_map.hpp b/include/boost/unordered/unordered_flat_map.hpp index 56ec1261e..e478314af 100644 --- a/include/boost/unordered/unordered_flat_map.hpp +++ b/include/boost/unordered/unordered_flat_map.hpp @@ -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) @@ -182,9 +183,10 @@ namespace boost { { } - template + template ::value, int>::type = 0> unordered_flat_map( - concurrent_flat_map&& other) + concurrent_flat_map&& other) : table_(std::move(other.table_)) { } diff --git a/include/boost/unordered/unordered_flat_set.hpp b/include/boost/unordered/unordered_flat_set.hpp index b06a0d773..629750342 100644 --- a/include/boost/unordered/unordered_flat_set.hpp +++ b/include/boost/unordered/unordered_flat_set.hpp @@ -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) @@ -178,9 +179,10 @@ namespace boost { { } - template + template ::value, int>::type = 0> unordered_flat_set( - concurrent_flat_set&& other) + concurrent_flat_set&& other) : table_(std::move(other.table_)) { } diff --git a/include/boost/unordered/unordered_node_map.hpp b/include/boost/unordered/unordered_node_map.hpp index a9d7ef449..73dbdc841 100644 --- a/include/boost/unordered/unordered_node_map.hpp +++ b/include/boost/unordered/unordered_node_map.hpp @@ -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) @@ -189,9 +190,10 @@ namespace boost { { } - template + template ::value, int>::type = 0> unordered_node_map( - concurrent_node_map&& other) + concurrent_node_map&& other) : table_(std::move(other.table_)) { } diff --git a/include/boost/unordered/unordered_node_set.hpp b/include/boost/unordered/unordered_node_set.hpp index 1ac71b414..48a2e212d 100644 --- a/include/boost/unordered/unordered_node_set.hpp +++ b/include/boost/unordered/unordered_node_set.hpp @@ -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) @@ -187,9 +188,10 @@ namespace boost { { } - template + template ::value, int>::type = 0> unordered_node_set( - concurrent_node_set&& other) + concurrent_node_set&& other) : table_(std::move(other.table_)) { } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 902faf6e2..81f1e8100 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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() diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 40d206f66..31265e458 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -166,6 +166,9 @@ compile unordered/explicit_instantiation_tests.cpp : compile unordered/explicit_instantiation_tests.cpp : BOOST_UNORDERED_FOA_TESTS : foa_explicit_instantiation_tests ; compile cfoa/explicit_instantiation_tests.cpp : : cfoa_explicit_instantiation_tests ; +compile unordered/conversion_operator_tests.cpp : 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 diff --git a/test/cfoa/conversion_operator_tests.cpp b/test/cfoa/conversion_operator_tests.cpp new file mode 100644 index 000000000..71ca5611f --- /dev/null +++ b/test/cfoa/conversion_operator_tests.cpp @@ -0,0 +1,42 @@ +// Copyright 2026 Braden Ganetsky +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include +#include +#include +// Don't include the FOA headers here! + +using c_flat_map = boost::unordered::concurrent_flat_map; +using c_flat_set = boost::unordered::concurrent_flat_set; +using c_node_map = boost::unordered::concurrent_node_map; +using c_node_set = boost::unordered::concurrent_node_set; + +struct constrained_template_converter +{ + struct dummy + { + }; + template ::value, int>::type = 0> + operator T() const + { + return T{}; + } +}; + +// Check whether the corresponding FOA container gets instantiated. +// The FOA headers aren't included, so this would fail to compile if the FOA +// container was instantiated. +BOOST_STATIC_ASSERT( + (!std::is_constructible::value)); +BOOST_STATIC_ASSERT( + (!std::is_constructible::value)); +BOOST_STATIC_ASSERT( + (!std::is_constructible::value)); +BOOST_STATIC_ASSERT( + (!std::is_constructible::value)); + +int main() { return 0; } diff --git a/test/unordered/conversion_operator_tests.cpp b/test/unordered/conversion_operator_tests.cpp new file mode 100644 index 000000000..c1c1492bd --- /dev/null +++ b/test/unordered/conversion_operator_tests.cpp @@ -0,0 +1,46 @@ +// Copyright 2026 Braden Ganetsky +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#if !defined(BOOST_UNORDERED_FOA_TESTS) +#error "This test is only for the FOA-style conatiners" +#endif + +#include +#include +#include +#include +#include +// Don't include the CFOA headers here! + +using flat_map = boost::unordered::unordered_flat_map; +using flat_set = boost::unordered::unordered_flat_set; +using node_map = boost::unordered::unordered_node_map; +using node_set = boost::unordered::unordered_node_set; + +struct constrained_template_converter +{ + struct dummy + { + }; + template ::value, int>::type = 0> + operator T() const + { + return T{}; + } +}; + +// Check whether the corresponding CFOA container gets instantiated. +// The CFOA headers aren't included, so this would fail to compile if the CFOA +// container was instantiated. +BOOST_STATIC_ASSERT( + (!std::is_constructible::value)); +BOOST_STATIC_ASSERT( + (!std::is_constructible::value)); +BOOST_STATIC_ASSERT( + (!std::is_constructible::value)); +BOOST_STATIC_ASSERT( + (!std::is_constructible::value)); + +int main() { return 0; }