summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qiterator.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qiterator.h')
-rw-r--r--src/corelib/tools/qiterator.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/corelib/tools/qiterator.h b/src/corelib/tools/qiterator.h
index 84a0e116ca..c4665c7c87 100644
--- a/src/corelib/tools/qiterator.h
+++ b/src/corelib/tools/qiterator.h
@@ -195,7 +195,6 @@ public:
typedef typename Iterator::iterator_category iterator_category;
typedef typename Iterator::difference_type difference_type;
typedef std::pair<Key, T> value_type;
- typedef const value_type *pointer;
typedef const value_type &reference;
QKeyValueIterator() = default;
@@ -206,6 +205,31 @@ public:
return std::pair<Key, T>(i.key(), i.value());
}
+ struct pointer {
+ pointer(value_type&& r_)
+ : r(std::move(r_))
+ {}
+
+ pointer() = default;
+ pointer(const pointer &other) = default;
+ pointer(pointer &&other) = default;
+ pointer& operator=(const pointer &other) = default;
+ pointer& operator=(pointer &&other) = default;
+
+ value_type& operator*() const {
+ return r;
+ }
+
+ value_type r;
+ const value_type *operator->() const {
+ return &r;
+ }
+ };
+
+ pointer operator->() const {
+ return pointer(std::pair<Key, T>(i.key(), i.value()));
+ }
+
friend bool operator==(QKeyValueIterator lhs, QKeyValueIterator rhs) noexcept { return lhs.i == rhs.i; }
friend bool operator!=(QKeyValueIterator lhs, QKeyValueIterator rhs) noexcept { return lhs.i != rhs.i; }