From 7c861a36f98972b64379589477930e2e894b0d72 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Sat, 8 Aug 2020 12:49:57 +0200 Subject: Fix compilation in C++20 mode The comparisons with pointer were ambiguous as the comparisons could be done between iterators or pointers. Change-Id: I0484946931502d04bd63519fcd6e886c732758d3 Reviewed-by: Thiago Macieira --- src/corelib/tools/qarraydata.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index 89f267ac49..0226fa4c92 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -153,6 +153,8 @@ struct QTypedArrayData inline constexpr bool operator<=(iterator other) const { return i <= other.i; } inline constexpr bool operator>(iterator other) const { return i > other.i; } inline constexpr bool operator>=(iterator other) const { return i >= other.i; } + inline constexpr bool operator==(pointer p) const { return i == p; } + inline constexpr bool operator!=(pointer p) const { return i != p; } inline iterator &operator++() { ++i; return *this; } inline iterator operator++(int) { T *n = i; ++i; return n; } inline iterator &operator--() { i--; return *this; } @@ -181,12 +183,16 @@ struct QTypedArrayData inline const T &operator*() const { return *i; } inline const T *operator->() const { return i; } inline const T &operator[](qsizetype j) const { return *(i + j); } - inline bool operator==(const_iterator o) const { return i == o.i; } - inline bool operator!=(const_iterator o) const { return i != o.i; } - inline bool operator<(const_iterator other) const { return i < other.i; } - inline bool operator<=(const_iterator other) const { return i <= other.i; } - inline bool operator>(const_iterator other) const { return i > other.i; } - inline bool operator>=(const_iterator other) const { return i >= other.i; } + inline constexpr bool operator==(const_iterator o) const { return i == o.i; } + inline constexpr bool operator!=(const_iterator o) const { return i != o.i; } + inline constexpr bool operator<(const_iterator other) const { return i < other.i; } + inline constexpr bool operator<=(const_iterator other) const { return i <= other.i; } + inline constexpr bool operator>(const_iterator other) const { return i > other.i; } + inline constexpr bool operator>=(const_iterator other) const { return i >= other.i; } + inline constexpr bool operator==(iterator o) const { return i == const_iterator(o).i; } + inline constexpr bool operator!=(iterator o) const { return i != const_iterator(o).i; } + inline constexpr bool operator==(pointer p) const { return i == p; } + inline constexpr bool operator!=(pointer p) const { return i != p; } inline const_iterator &operator++() { ++i; return *this; } inline const_iterator operator++(int) { const T *n = i; ++i; return n; } inline const_iterator &operator--() { i--; return *this; } -- cgit v1.2.3