mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +02:00
Update test Hash, KeyEqual to be nothrow swappable
This commit is contained in:
@ -227,8 +227,21 @@ namespace test {
|
|||||||
}
|
}
|
||||||
return x1.tag_ != x2.tag_;
|
return x1.tag_ != x2.tag_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(BOOST_UNORDERED_FOA_TESTS)
|
||||||
|
friend void swap(hash&, hash&) noexcept;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(BOOST_UNORDERED_FOA_TESTS)
|
||||||
|
void swap(hash& lhs, hash& rhs) noexcept
|
||||||
|
{
|
||||||
|
int tag = lhs.tag_;
|
||||||
|
lhs.tag_ = rhs.tag_;
|
||||||
|
rhs.tag_ = tag;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
class less
|
class less
|
||||||
{
|
{
|
||||||
int tag_;
|
int tag_;
|
||||||
@ -364,8 +377,20 @@ namespace test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
friend less create_compare(equal_to x) { return less(x.tag_); }
|
friend less create_compare(equal_to x) { return less(x.tag_); }
|
||||||
|
#if defined(BOOST_UNORDERED_FOA_TESTS)
|
||||||
|
friend void swap(equal_to&, equal_to&) noexcept;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(BOOST_UNORDERED_FOA_TESTS)
|
||||||
|
void swap(equal_to& lhs, equal_to& rhs) noexcept
|
||||||
|
{
|
||||||
|
int tag = lhs.tag_;
|
||||||
|
lhs.tag_ = rhs.tag_;
|
||||||
|
rhs.tag_ = tag;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class T> class allocator
|
template <class T> class allocator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -206,6 +206,11 @@ namespace test {
|
|||||||
hash& operator=(hash const&) { return *this; }
|
hash& operator=(hash const&) { return *this; }
|
||||||
~hash() {}
|
~hash() {}
|
||||||
|
|
||||||
|
#if defined(BOOST_UNORDERED_FOA_TESTS)
|
||||||
|
hash(hash&&) = default;
|
||||||
|
hash& operator=(hash&&) = default;
|
||||||
|
#endif
|
||||||
|
|
||||||
std::size_t operator()(T const&) const { return 0; }
|
std::size_t operator()(T const&) const { return 0; }
|
||||||
#if BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED
|
#if BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED
|
||||||
ampersand_operator_used operator&() const
|
ampersand_operator_used operator&() const
|
||||||
@ -224,6 +229,11 @@ namespace test {
|
|||||||
equal_to& operator=(equal_to const&) { return *this; }
|
equal_to& operator=(equal_to const&) { return *this; }
|
||||||
~equal_to() {}
|
~equal_to() {}
|
||||||
|
|
||||||
|
#if defined(BOOST_UNORDERED_FOA_TESTS)
|
||||||
|
equal_to(equal_to&&) = default;
|
||||||
|
equal_to& operator=(equal_to&&) = default;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool operator()(T const&, T const&) const { return true; }
|
bool operator()(T const&, T const&) const { return true; }
|
||||||
#if BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED
|
#if BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED
|
||||||
ampersand_operator_used operator&() const
|
ampersand_operator_used operator&() const
|
||||||
|
Reference in New Issue
Block a user