diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index d1a2a66f7..09b516d41 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -24,6 +24,9 @@ #include "encodedstream.h" #include // placement new #include +#ifdef __cpp_impl_three_way_comparison +#include +#endif RAPIDJSON_DIAG_PUSH #ifdef _MSC_VER @@ -174,12 +177,17 @@ class GenericMemberIterator { //! @name relations //@{ +#ifdef __cpp_impl_three_way_comparison + template bool operator==(const GenericMemberIterator& that) const { return ptr_ == that.ptr_; } + template std::strong_ordering operator<=>(const GenericMemberIterator& that) const { return ptr_ <=> that.ptr_; } +#else bool operator==(ConstIterator that) const { return ptr_ == that.ptr_; } bool operator!=(ConstIterator that) const { return ptr_ != that.ptr_; } bool operator<=(ConstIterator that) const { return ptr_ <= that.ptr_; } bool operator>=(ConstIterator that) const { return ptr_ >= that.ptr_; } bool operator< (ConstIterator that) const { return ptr_ < that.ptr_; } bool operator> (ConstIterator that) const { return ptr_ > that.ptr_; } +#endif //@} //! @name dereference