diff --git a/include/boost/unordered/unordered_flat_map.hpp b/include/boost/unordered/unordered_flat_map.hpp index 3bb3122b..b7106e24 100644 --- a/include/boost/unordered/unordered_flat_map.hpp +++ b/include/boost/unordered/unordered_flat_map.hpp @@ -79,6 +79,16 @@ namespace boost { this->insert(first, last); } + unordered_flat_map(unordered_flat_map const& other) : table_(other.table_) + { + } + + unordered_flat_map( + unordered_flat_map const& other, allocator_type const& a) + : table_(other.table_, a) + { + } + unordered_flat_map(std::initializer_list ilist, size_type n = 0, hasher const& h = hasher(), key_equal const& pred = key_equal(), diff --git a/include/boost/unordered/unordered_flat_set.hpp b/include/boost/unordered/unordered_flat_set.hpp index c7bed6fc..3a1f5178 100644 --- a/include/boost/unordered/unordered_flat_set.hpp +++ b/include/boost/unordered/unordered_flat_set.hpp @@ -78,6 +78,16 @@ namespace boost { this->insert(first, last); } + unordered_flat_set(unordered_flat_set const& other) : table_(other.table_) + { + } + + unordered_flat_set( + unordered_flat_set const& other, allocator_type const& a) + : table_(other.table_, a) + { + } + unordered_flat_set(std::initializer_list ilist, size_type n = 0, hasher const& h = hasher(), key_equal const& pred = key_equal(), diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index b07b2313..ca746a62 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -50,6 +50,7 @@ run unordered/equivalent_keys_tests.cpp ; run unordered/constructor_tests.cpp ; run unordered/constructor_tests.cpp : : : $(CPP14) BOOST_UNORDERED_FOA_TESTS : foa_constructor_tests ; run unordered/copy_tests.cpp ; +run unordered/copy_tests.cpp : : : $(CPP14) BOOST_UNORDERED_FOA_TESTS : foa_copy_tests ; run unordered/move_tests.cpp ; run unordered/assign_tests.cpp ; run unordered/insert_tests.cpp ; diff --git a/test/unordered/copy_tests.cpp b/test/unordered/copy_tests.cpp index f7c0ddd8..f8be49b7 100644 --- a/test/unordered/copy_tests.cpp +++ b/test/unordered/copy_tests.cpp @@ -1,14 +1,18 @@ // Copyright 2006-2009 Daniel James. +// Copyright (C) 2022 Christian Mazakas // 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) -// clang-format off #include "../helpers/prefix.hpp" +#ifdef BOOST_UNORDERED_FOA_TESTS +#include +#include +#else #include #include +#endif #include "../helpers/postfix.hpp" -// clang-format on #include "../helpers/test.hpp" #include "../objects/test.hpp" @@ -229,6 +233,38 @@ namespace copy_tests { } } + using test::default_generator; + using test::generate_collisions; + using test::limited_range; + +#ifdef BOOST_UNORDERED_FOA_TESTS + boost::unordered_flat_set >* test_set; + boost::unordered_flat_map >* test_map; + + boost::unordered_flat_set >* + test_set_select_copy; + boost::unordered_flat_map >* + test_map_select_copy; + + boost::unordered_flat_set >* + test_set_no_select_copy; + boost::unordered_flat_map >* + test_map_no_select_copy; + + UNORDERED_TEST(copy_construct_tests1, + ((test_set)(test_map)(test_set_select_copy)(test_map_select_copy)(test_set_no_select_copy)(test_map_no_select_copy))( + (default_generator)(generate_collisions)(limited_range))) + + UNORDERED_TEST(copy_construct_tests2, + ((test_set)(test_map)(test_set_select_copy)(test_map_select_copy)(test_set_no_select_copy)(test_map_no_select_copy))( + (default_generator)(generate_collisions)(limited_range))) +#else boost::unordered_set >* test_set; boost::unordered_multiset >* test_multimap_no_select_copy; - using test::default_generator; - using test::generate_collisions; - using test::limited_range; - UNORDERED_TEST(copy_construct_tests1, - ((test_set)(test_multiset)(test_map)(test_multimap)(test_set_select_copy)( - test_multiset_select_copy)(test_map_select_copy)( - test_multimap_select_copy)(test_set_no_select_copy)( - test_multiset_no_select_copy)(test_map_no_select_copy)( - test_multimap_no_select_copy))( + ((test_set)(test_multiset)(test_map)(test_multimap)(test_set_select_copy)(test_multiset_select_copy)(test_map_select_copy)(test_multimap_select_copy)(test_set_no_select_copy)(test_multiset_no_select_copy)(test_map_no_select_copy)(test_multimap_no_select_copy))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(copy_construct_tests2, - ((test_set)(test_multiset)(test_map)(test_multimap)(test_set_select_copy)( - test_multiset_select_copy)(test_map_select_copy)( - test_multimap_select_copy)(test_set_no_select_copy)( - test_multiset_no_select_copy)(test_map_no_select_copy)( - test_multimap_no_select_copy))( + ((test_set)(test_multiset)(test_map)(test_multimap)(test_set_select_copy)(test_multiset_select_copy)(test_map_select_copy)(test_multimap_select_copy)(test_set_no_select_copy)(test_multiset_no_select_copy)(test_map_no_select_copy)(test_multimap_no_select_copy))( (default_generator)(generate_collisions)(limited_range))) -} +#endif +} // namespace copy_tests RUN_TESTS()