mirror of
https://github.com/boostorg/unordered.git
synced 2025-11-03 09:11:42 +01:00
documented non-const reference passing to erase_if (#312)
* documented non-const reference passing to erase_if * prevented warning as error in Boost.Container build * skipped tests for MinGW (https://github.com/boostorg/atomic/pull/70) * correct reference link for previous commit is https://github.com/boostorg/atomic/issues/73 * commented previous disabled cases * disabled cfoa_serialization_tests with TSAN * fixed previous * fixed previous * fixed previous
This commit is contained in:
@@ -156,7 +156,9 @@ run unordered/serialization_tests.cpp
|
||||
<toolset>gcc:<optimization>space
|
||||
<toolset>clang:<inlining>on
|
||||
<toolset>clang:<optimization>space
|
||||
<library>/boost/serialization//boost_serialization/<warnings>off ;
|
||||
<library>/boost/serialization//boost_serialization/<warnings>off
|
||||
<library>/boost/container//boost_container/<warnings-as-errors>off
|
||||
<toolset>gcc,<target-os>windows:<build>no ; # Boost.Atomic no longer supports MinGW
|
||||
|
||||
compile-fail unordered/insert_node_type_fail.cpp : <define>UNORDERED_TEST_MAP : insert_node_type_fail_map ;
|
||||
compile-fail unordered/insert_node_type_fail.cpp : <define>UNORDERED_TEST_MULTIMAP : insert_node_type_fail_multimap ;
|
||||
@@ -266,6 +268,8 @@ run unordered/serialization_tests.cpp
|
||||
<toolset>clang:<inlining>on
|
||||
<toolset>clang:<optimization>space
|
||||
<library>/boost/serialization//boost_serialization/<warnings>off
|
||||
<library>/boost/container//boost_container/<warnings-as-errors>off
|
||||
<toolset>gcc,<target-os>windows:<build>no # Boost.Atomic no longer supports MinGW
|
||||
: foa_serialization_tests ;
|
||||
|
||||
local FOA_EXCEPTION_TESTS =
|
||||
@@ -402,6 +406,10 @@ run cfoa/serialization_tests.cpp
|
||||
<toolset>clang:<inlining>on
|
||||
<toolset>clang:<optimization>space
|
||||
<library>/boost/serialization//boost_serialization/<warnings>off
|
||||
<library>/boost/container//boost_container/<warnings-as-errors>off
|
||||
<toolset>gcc,<target-os>windows:<build>no # Boost.Atomic no longer supports MinGW
|
||||
<toolset>gcc,<thread-sanitizer>norecover:<build>no # TSAN does not support atomic_thread_fence
|
||||
<toolset>clang,<thread-sanitizer>norecover:<build>no # idem
|
||||
: cfoa_serialization_tests ;
|
||||
|
||||
rule make_cfoa_interprocess_concurrency_tests ( name : defines ? )
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Copyright 2021-2022 Christian Mazakas.
|
||||
// Copyright 2025 Joaquin M Lopez Munoz.
|
||||
// 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)
|
||||
|
||||
@@ -42,8 +43,35 @@ namespace test {
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct non_const_pred;
|
||||
|
||||
template<class T, class U>
|
||||
struct non_const_pred<std::pair<const T, U> >
|
||||
{
|
||||
bool operator()(std::pair<const T, U>& x) const
|
||||
{
|
||||
U u = std::move(x.second);
|
||||
(void)u;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
|
||||
template <class UnorderedMap> void test_map_nonconst_erase_if()
|
||||
{
|
||||
typedef UnorderedMap map_type;
|
||||
typedef typename map_type::value_type value_type;
|
||||
typedef typename map_type::size_type size_type;
|
||||
|
||||
map_type m;
|
||||
m.insert(value_type());
|
||||
size_type num_erased = erase_if(m, test::non_const_pred<value_type>());
|
||||
BOOST_TEST(m.empty());
|
||||
BOOST_TEST_EQ(num_erased, 1u);
|
||||
}
|
||||
|
||||
template <class UnorderedMap> void test_map_erase_if()
|
||||
{
|
||||
typedef UnorderedMap map_type;
|
||||
@@ -71,6 +99,8 @@ template <class UnorderedMap> void test_map_erase_if()
|
||||
num_erased = erase_if(map, test::is_even());
|
||||
BOOST_TEST_EQ(map.size(), 2u);
|
||||
BOOST_TEST_EQ(num_erased, size - map.size());
|
||||
|
||||
test_map_nonconst_erase_if<map_type>();
|
||||
}
|
||||
|
||||
template <class UnorderedSet> void test_set_erase_if()
|
||||
|
||||
Reference in New Issue
Block a user