diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 5daf53ee..1352d462 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -827,13 +827,13 @@ namespace boost { T* operator->() { return value_.value_ptr(); } T const* operator->() const { return value_.value_ptr(); } - bool operator==(optional const& x) + bool operator==(optional const& x) const { return has_value_ ? x.has_value_ && value_.value() == x.value_.value() : !x.has_value_; } - bool operator!=(optional const& x) { return !((*this) == x); } + bool operator!=(optional const& x) const { return !((*this) == x); } void swap(optional& x) { diff --git a/test/helpers/list.hpp b/test/helpers/list.hpp index d39c766e..3fddd6d3 100644 --- a/test/helpers/list.hpp +++ b/test/helpers/list.hpp @@ -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_; } }; diff --git a/test/unordered/allocator_traits.cpp b/test/unordered/allocator_traits.cpp index 476205b7..0517fb97 100644 --- a/test/unordered/allocator_traits.cpp +++ b/test/unordered/allocator_traits.cpp @@ -65,9 +65,9 @@ { \ return (std::numeric_limits::max)(); \ } \ - bool operator==(name const&) { return true; } \ - bool operator!=(name const&) { return false; } \ -/**/ + bool operator==(name const&) const { return true; } \ + bool operator!=(name const&) const { return false; } \ + /**/ struct yes_type { diff --git a/test/unordered/deduction_tests.cpp b/test/unordered/deduction_tests.cpp index 673c0609..cffb0c1d 100644 --- a/test/unordered/deduction_tests.cpp +++ b/test/unordered/deduction_tests.cpp @@ -30,8 +30,8 @@ template struct test_allocator template test_allocator(test_allocator 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