diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-08-08 12:49:57 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-08-08 19:09:09 +0200 |
commit | 7c861a36f98972b64379589477930e2e894b0d72 (patch) | |
tree | 0d6505344b40b52abd592b84de187be0ddf08013 /src/corelib/tools | |
parent | cabc24866715d49979400e52275aacb97a442c7d (diff) |
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 <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qarraydata.h | 18 |
1 files changed, 12 insertions, 6 deletions
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; } |