diff --git a/include/boost/unordered/unordered_flat_map_fwd.hpp b/include/boost/unordered/unordered_flat_map_fwd.hpp index 154b9093..2c34d0fb 100644 --- a/include/boost/unordered/unordered_flat_map_fwd.hpp +++ b/include/boost/unordered/unordered_flat_map_fwd.hpp @@ -22,9 +22,28 @@ namespace boost { class KeyEqual = std::equal_to, class Allocator = std::allocator > > class unordered_flat_map; - } + + template + bool operator==( + unordered_flat_map const& lhs, + unordered_flat_map const& rhs); + + template + bool operator!=( + unordered_flat_map const& lhs, + unordered_flat_map const& rhs); + + template + void swap(unordered_flat_map& lhs, + unordered_flat_map& rhs) + noexcept(noexcept(lhs.swap(rhs))); + } // namespace unordered using boost::unordered::unordered_flat_map; + + using boost::unordered::swap; + using boost::unordered::operator==; + using boost::unordered::operator!=; } // namespace boost #endif diff --git a/include/boost/unordered/unordered_flat_set_fwd.hpp b/include/boost/unordered/unordered_flat_set_fwd.hpp index 91550cc0..51f534ef 100644 --- a/include/boost/unordered/unordered_flat_set_fwd.hpp +++ b/include/boost/unordered/unordered_flat_set_fwd.hpp @@ -22,9 +22,28 @@ namespace boost { class KeyEqual = std::equal_to, class Allocator = std::allocator > class unordered_flat_set; - } + + template + bool operator==( + unordered_flat_set const& lhs, + unordered_flat_set const& rhs); + + template + bool operator!=( + unordered_flat_set const& lhs, + unordered_flat_set const& rhs); + + template + void swap(unordered_flat_set& lhs, + unordered_flat_set& rhs) + noexcept(noexcept(lhs.swap(rhs))); + } // namespace unordered using boost::unordered::unordered_flat_set; + + using boost::unordered::swap; + using boost::unordered::operator==; + using boost::unordered::operator!=; } // namespace boost #endif diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index c86df6f2..2a3e4f84 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -102,6 +102,8 @@ rule build_foa ( name ) run unordered/$(name).cpp : : : 98:no 03:no 0x:no BOOST_UNORDERED_FOA_TESTS : foa_$(name) ; } +build_foa fwd_set_test ; +build_foa fwd_map_test ; build_foa constructor_tests ; build_foa copy_tests ; build_foa move_tests ; diff --git a/test/unordered/fwd_map_test.cpp b/test/unordered/fwd_map_test.cpp index 0c7df04f..30acf14e 100644 --- a/test/unordered/fwd_map_test.cpp +++ b/test/unordered/fwd_map_test.cpp @@ -5,10 +5,39 @@ // clang-format off #include "../helpers/prefix.hpp" +#ifdef BOOST_UNORDERED_FOA_TESTS +#include +#include +#else #include +#endif #include "../helpers/postfix.hpp" // clang-format on +#ifdef BOOST_UNORDERED_FOA_TESTS +template +void call_swap( + boost::unordered_flat_map& x, boost::unordered_flat_map& y) +{ + swap(x, y); +} + +template +bool call_equals( + boost::unordered_flat_map& x, boost::unordered_flat_map& y) +{ + return x == y; +} + +template +bool call_not_equals( + boost::unordered_flat_map& x, boost::unordered_flat_map& y) +{ + return x != y; +} + +#include +#else template void call_swap(boost::unordered_map& x, boost::unordered_map& y) { @@ -50,10 +79,15 @@ bool call_not_equals( } #include +#endif #include "../helpers/test.hpp" +#ifdef BOOST_UNORDERED_FOA_TESTS +typedef boost::unordered_flat_map int_map; +#else typedef boost::unordered_map int_map; typedef boost::unordered_multimap int_multimap; +#endif UNORDERED_AUTO_TEST (use_map_fwd_declared_function) { int_map x, y; @@ -71,11 +105,13 @@ UNORDERED_AUTO_TEST (use_map_fwd_declared_function) { BOOST_TEST(call_not_equals(x, y)); } +#ifndef BOOST_UNORDERED_FOA_TESTS UNORDERED_AUTO_TEST (use_multimap_fwd_declared_function) { int_multimap x, y; call_swap(x, y); BOOST_TEST(call_equals(x, y)); BOOST_TEST(!call_not_equals(x, y)); } +#endif RUN_TESTS() diff --git a/test/unordered/fwd_set_test.cpp b/test/unordered/fwd_set_test.cpp index 6512522a..58de82d5 100644 --- a/test/unordered/fwd_set_test.cpp +++ b/test/unordered/fwd_set_test.cpp @@ -5,7 +5,12 @@ // clang-format off #include "../helpers/prefix.hpp" +#ifdef BOOST_UNORDERED_FOA_TESTS +#include +#include +#else #include +#endif #include "../helpers/postfix.hpp" // clang-format on @@ -20,6 +25,31 @@ struct false_type false_type is_unordered_set_impl(void*); +#ifdef BOOST_UNORDERED_FOA_TESTS +template +true_type is_unordered_set_impl( + boost::unordered_flat_set*); + +template +void call_swap(boost::unordered_flat_set& x, boost::unordered_flat_set& y) +{ + swap(x, y); +} + +template +bool call_equals( + boost::unordered_flat_set& x, boost::unordered_flat_set& y) +{ + return x == y; +} + +template +bool call_not_equals( + boost::unordered_flat_set& x, boost::unordered_flat_set& y) +{ + return x != y; +} +#else template true_type is_unordered_set_impl( boost::unordered_set*); @@ -41,7 +71,9 @@ bool call_not_equals(boost::unordered_set& x, boost::unordered_set& y) { return x != y; } +#endif +#ifndef BOOST_UNORDERED_FOA_TESTS template void call_swap(boost::unordered_multiset& x, boost::unordered_multiset& y) { @@ -61,20 +93,29 @@ bool call_not_equals( { return x != y; } +#endif #include "../helpers/test.hpp" +#ifdef BOOST_UNORDERED_FOA_TESTS +typedef boost::unordered_flat_set int_set; +#else typedef boost::unordered_set int_set; typedef boost::unordered_multiset int_multiset; +#endif UNORDERED_AUTO_TEST (use_fwd_declared_trait_without_definition) { BOOST_TEST(sizeof(is_unordered_set_impl((int_set*)0)) == sizeof(true_type)); } +#ifdef BOOST_UNORDERED_FOA_TESTS +#include +#else #include +#endif UNORDERED_AUTO_TEST (use_fwd_declared_trait) { - boost::unordered_set x; + int_set x; BOOST_TEST(sizeof(is_unordered_set_impl(&x)) == sizeof(true_type)); BOOST_TEST(sizeof(is_unordered_set_impl((int*)0)) == sizeof(false_type)); @@ -96,11 +137,13 @@ UNORDERED_AUTO_TEST (use_set_fwd_declared_function) { BOOST_TEST(call_not_equals(x, y)); } +#ifndef BOOST_UNORDERED_FOA_TESTS UNORDERED_AUTO_TEST (use_multiset_fwd_declared_function) { int_multiset x, y; call_swap(x, y); BOOST_TEST(call_equals(x, y)); BOOST_TEST(!call_not_equals(x, y)); } +#endif RUN_TESTS()