Three-way comparison for CLang 10 fix (#1679)

C++20 features must enable additional functionality, not to change interface completely
This commit is contained in:
Nikolay 2020-03-30 07:20:35 +05:00 committed by GitHub
parent 2661a17c7e
commit ebcbd04484
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,7 @@
#include "encodedstream.h" #include "encodedstream.h"
#include <new> // placement new #include <new> // placement new
#include <limits> #include <limits>
#ifdef __cpp_impl_three_way_comparison #ifdef __cpp_lib_three_way_comparison
#include <compare> #include <compare>
#endif #endif
@ -250,16 +250,15 @@ public:
//! @name relations //! @name relations
//@{ //@{
#ifdef __cpp_impl_three_way_comparison template <bool Const_> bool operator==(const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ == that.ptr_; }
template <bool Const_> bool operator==(const GenericMemberIterator<Const_,Encoding,Allocator>& that) const { return ptr_ == that.ptr_; } template <bool Const_> bool operator!=(const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ != that.ptr_; }
template <bool Const_> std::strong_ordering operator<=>(const GenericMemberIterator<Const_,Encoding,Allocator>& that) const { return ptr_ <=> that.ptr_; } template <bool Const_> bool operator<=(const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ <= that.ptr_; }
#else template <bool Const_> bool operator>=(const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ >= that.ptr_; }
bool operator==(ConstIterator that) const { return ptr_ == that.ptr_; } template <bool Const_> bool operator< (const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ < that.ptr_; }
bool operator!=(ConstIterator that) const { return ptr_ != that.ptr_; } template <bool Const_> bool operator> (const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ > that.ptr_; }
bool operator<=(ConstIterator that) const { return ptr_ <= that.ptr_; }
bool operator>=(ConstIterator that) const { return ptr_ >= that.ptr_; } #ifdef __cpp_lib_three_way_comparison
bool operator< (ConstIterator that) const { return ptr_ < that.ptr_; } template <bool Const_> std::strong_ordering operator<=>(const GenericMemberIterator<Const_, Encoding, Allocator>& that) const { return ptr_ <=> that.ptr_; }
bool operator> (ConstIterator that) const { return ptr_ > that.ptr_; }
#endif #endif
//@} //@}