mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-29 19:07:15 +02:00
Merge pull request #38 from LeonineKing1199/ambiguous-reversed-operator
Ambiguous reversed operator fixes
This commit is contained in:
@ -827,13 +827,13 @@ namespace boost {
|
||||
T* operator->() { return value_.value_ptr(); }
|
||||
T const* operator->() const { return value_.value_ptr(); }
|
||||
|
||||
bool operator==(optional<T> const& x)
|
||||
bool operator==(optional<T> const& x) const
|
||||
{
|
||||
return has_value_ ? x.has_value_ && value_.value() == x.value_.value()
|
||||
: !x.has_value_;
|
||||
}
|
||||
|
||||
bool operator!=(optional<T> const& x) { return !((*this) == x); }
|
||||
bool operator!=(optional<T> const& x) const { return !((*this) == x); }
|
||||
|
||||
void swap(optional<T>& x)
|
||||
{
|
||||
|
@ -113,6 +113,10 @@ namespace test {
|
||||
ptr_ = ptr_->next_;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
bool operator==(list_iterator y) const { return ptr_ == y.ptr_; }
|
||||
bool operator!=(list_iterator y) const { return ptr_ != y.ptr_; }
|
||||
|
||||
bool operator==(const_iterator y) const { return ptr_ == y.ptr_; }
|
||||
bool operator!=(const_iterator y) const { return ptr_ != y.ptr_; }
|
||||
};
|
||||
|
@ -65,9 +65,9 @@
|
||||
{ \
|
||||
return (std::numeric_limits<size_type>::max)(); \
|
||||
} \
|
||||
bool operator==(name<T> const&) { return true; } \
|
||||
bool operator!=(name<T> const&) { return false; } \
|
||||
/**/
|
||||
bool operator==(name<T> const&) const { return true; } \
|
||||
bool operator!=(name<T> const&) const { return false; } \
|
||||
/**/
|
||||
|
||||
struct yes_type
|
||||
{
|
||||
|
@ -30,8 +30,8 @@ template <typename T> struct test_allocator
|
||||
template <typename T2> test_allocator(test_allocator<T2> const&) {}
|
||||
T* allocate(std::size_t n) const { return (T*)malloc(sizeof(T) * n); }
|
||||
void deallocate(T* ptr, std::size_t) const { free(ptr); }
|
||||
bool operator==(test_allocator const&) { return true; }
|
||||
bool operator!=(test_allocator const&) { return false; }
|
||||
bool operator==(test_allocator const&) const { return true; }
|
||||
bool operator!=(test_allocator const&) const { return false; }
|
||||
};
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user