diff --git a/include/boost/unordered/concurrent_flat_map.hpp b/include/boost/unordered/concurrent_flat_map.hpp index 499fe4a2..d5ac9cc0 100644 --- a/include/boost/unordered/concurrent_flat_map.hpp +++ b/include/boost/unordered/concurrent_flat_map.hpp @@ -15,6 +15,7 @@ #ifndef BOOST_UNORDERED_CONCURRENT_FLAT_MAP_HPP #define BOOST_UNORDERED_CONCURRENT_FLAT_MAP_HPP +#include #include #include @@ -134,9 +135,7 @@ namespace boost { }; } // namespace detail - template , - class Pred = std::equal_to, - class Allocator = std::allocator > > + template class concurrent_flat_map { private: @@ -803,6 +802,7 @@ namespace boost { } // namespace unordered + using unordered::concurrent_flat_map; } // namespace boost #undef BOOST_UNORDERED_STATIC_ASSERT_INVOCABLE diff --git a/include/boost/unordered/concurrent_flat_map_fwd.hpp b/include/boost/unordered/concurrent_flat_map_fwd.hpp new file mode 100644 index 00000000..308f099c --- /dev/null +++ b/include/boost/unordered/concurrent_flat_map_fwd.hpp @@ -0,0 +1,58 @@ +/* Fast open-addressing concurrent hash table. + * + * Copyright 2023 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) + * + * See https://www.boost.org/libs/unordered for library home page. + */ + +/* Reference: + * https://github.com/joaquintides/concurrent_hashmap_api#proposed-synopsis + */ + +#ifndef BOOST_UNORDERED_CONCURRENT_FLAT_MAP_FWD_HPP +#define BOOST_UNORDERED_CONCURRENT_FLAT_MAP_FWD_HPP + +#include + +#include +#include + +namespace boost { + namespace unordered { + + template , + class Pred = std::equal_to, + class Allocator = std::allocator > > + class concurrent_flat_map; + + template + bool operator==( + concurrent_flat_map const& lhs, + concurrent_flat_map const& rhs); + + template + bool operator!=( + concurrent_flat_map const& lhs, + concurrent_flat_map const& rhs); + + template + void swap(concurrent_flat_map& x, + concurrent_flat_map& y) + noexcept(noexcept(x.swap(y))); + + template + typename concurrent_flat_map::size_type erase_if( + concurrent_flat_map& c, Predicate pred); + + } // namespace unordered + + using unordered::concurrent_flat_map; + using unordered::swap; + using unordered::operator==; + using unordered::operator!=; +} // namespace boost + +#endif // BOOST_UNORDERED_CONCURRENT_FLAT_MAP_HPP diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 75ada20f..a84bc78f 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -189,6 +189,7 @@ local CFOA_TESTS = merge_tests rehash_tests equality_tests + fwd_tests ; for local test in $(CFOA_TESTS) diff --git a/test/cfoa/fwd_tests.cpp b/test/cfoa/fwd_tests.cpp new file mode 100644 index 00000000..8e88f849 --- /dev/null +++ b/test/cfoa/fwd_tests.cpp @@ -0,0 +1,55 @@ +// Copyright (C) 2023 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) + +#include "helpers.hpp" + +#include + +test::seed_t initialize_seed{32304628}; + +using test::default_generator; +using test::limited_range; +using test::sequential; + +template +void swap_call(boost::unordered::concurrent_flat_map& x1, + boost::unordered::concurrent_flat_map& x2) +{ + swap(x1, x2); +} + +template +bool equal_call(boost::unordered::concurrent_flat_map& x1, + boost::unordered::concurrent_flat_map& x2) +{ + return x1 == x2; +} + +template +bool unequal_call(boost::unordered::concurrent_flat_map& x1, + boost::unordered::concurrent_flat_map& x2) +{ + return x1 != x2; +} + +#include + +using map_type = boost::unordered::concurrent_flat_map; + +UNORDERED_AUTO_TEST (fwd_swap_call) { + map_type x1, x2; + swap_call(x1, x2); +} + +UNORDERED_AUTO_TEST (fwd_equal_call) { + map_type x1, x2; + BOOST_TEST(equal_call(x1, x2)); +} + +UNORDERED_AUTO_TEST (fwd_unequal_call) { + map_type x1, x2; + BOOST_TEST_NOT(unequal_call(x1, x2)); +} + +RUN_TESTS()