Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/miloyip/rapidjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Geissler @ Amadeus <romain.geissler@amadeus.com>2020-03-20 08:39:48 +0300
committerGitHub <noreply@github.com>2020-03-20 08:39:48 +0300
commit2661a17c7eaede8c881e7455f5a66fd593ed8633 (patch)
tree8815fa77a277850003e4e8c43572e311bc318724 /include
parent814bb27bf0f1e3e924fc5c8e374dedf85c9cc70a (diff)
Avoid warnings when using -std=c++20 and clang 10: use three way comparision for iterators when possible. (#1667)
/data/mwrep/res/osp/RapidJson/20-0-0-0/include/rapidjson/document.h:729:58: error: use of overloaded operator '!=' is ambiguous (with operand types 'rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >::MemberIterator' (aka 'rapidjson::GenericMemberIterator<false, rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >') and 'rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >::MemberIterator') for (MemberIterator m = MemberBegin(); m != MemberEnd(); ++m)
Diffstat (limited to 'include')
-rw-r--r--include/rapidjson/document.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h
index 3f66e41d..1a59a14e 100644
--- a/include/rapidjson/document.h
+++ b/include/rapidjson/document.h
@@ -24,6 +24,9 @@
#include "encodedstream.h"
#include <new> // placement new
#include <limits>
+#ifdef __cpp_impl_three_way_comparison
+#include <compare>
+#endif
RAPIDJSON_DIAG_PUSH
#ifdef __clang__
@@ -247,12 +250,17 @@ public:
//! @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_> std::strong_ordering operator<=>(const GenericMemberIterator<Const_,Encoding,Allocator>& 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