Ease test requiremets for erase_if, require copyability now of supplied predicate

This commit is contained in:
Christian Mazakas
2022-10-14 10:50:49 -07:00
parent 5e24f6ef22
commit 454cb24cc8

View File

@ -23,36 +23,13 @@
namespace test {
struct is_even
{
is_even() {}
#if BOOST_CXX_VERSION >= 201703L
// immovable for C++17
is_even(is_even const&) = delete;
is_even(is_even&&) = delete;
is_even& operator=(is_even const&) = delete;
is_even& operator=(is_even&&) = delete;
#elif BOOST_CXX_VERSION >= 201103L
// move-only for C++11
is_even(is_even const&) = delete;
is_even(is_even&&) = default;
is_even& operator=(is_even const&) = delete;
is_even& operator=(is_even&&) = default;
#else
// copyable otherwise
is_even(is_even const&) {}
is_even& operator=(is_even const&) { return *this; }
#endif
bool operator()(
std::pair<std::string const, int>& key_value) UNORDERED_LVALUE_QUAL
bool operator()(std::pair<std::string const, int>& key_value)
{
int const v = key_value.second;
return (v % 2 == 0);
}
bool operator()(int const& value) UNORDERED_LVALUE_QUAL
bool operator()(int const& value)
{
int const v = value;
return (v % 2 == 0);
@ -61,37 +38,13 @@ namespace test {
struct is_too_large
{
is_too_large() {}
#if BOOST_CXX_VERSION >= 201703L
// immovable for C++17
is_too_large(is_too_large const&) = delete;
is_too_large(is_too_large&&) = delete;
is_too_large& operator=(is_too_large const&) = delete;
is_too_large& operator=(is_too_large&&) = delete;
#elif BOOST_CXX_VERSION >= 201103L
// move-only for C++11
is_too_large(is_too_large const&) = delete;
is_too_large(is_too_large&&) = default;
is_too_large& operator=(is_too_large const&) = delete;
is_too_large& operator=(is_too_large&&) = default;
#else
// copyable otherwise
is_too_large(is_too_large const&) {}
is_too_large& operator=(is_too_large const&) { return *this; }
#endif
bool operator()(
std::pair<std::string const, int>& key_value) UNORDERED_LVALUE_QUAL
bool operator()(std::pair<std::string const, int>& key_value)
{
int const v = key_value.second;
return v >= 1000;
}
bool operator()(int const& value) UNORDERED_LVALUE_QUAL
bool operator()(int const& value)
{
int const v = value;
return v >= 1000;