summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qcontainertools_impl.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2024-01-23 18:28:25 +0100
committerMarc Mutz <marc.mutz@qt.io>2024-01-31 20:18:47 +0000
commit900d4bd29f30effbb5dbb0efa96886af03839a15 (patch)
tree3a949279799219eeb8f366b4f3f31cee736dd3f2 /src/corelib/tools/qcontainertools_impl.h
parent324fe120ba405f0eeca0b1a00cc5aee0ea99f76f (diff)
Add QtPrivate::ArrowProxy
... use it in QKeyValueIterator. This is somewhat simpler than the old QKeyValueIterator::pointer. I don't think the pointer::operator*() could have ever worked, because it returns value_type&, but is const. That leaves the defaulted copy and move SMFs as a difference (ArrowProxy is using aggregate initialization, so doesn't need any), and the fact that operator->() is const. Change-Id: I80b9c5f696de6ae30f3939166b205b9213eac57e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qcontainertools_impl.h')
-rw-r--r--src/corelib/tools/qcontainertools_impl.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/tools/qcontainertools_impl.h b/src/corelib/tools/qcontainertools_impl.h
index d66705ef4d..ef73a2a69f 100644
--- a/src/corelib/tools/qcontainertools_impl.h
+++ b/src/corelib/tools/qcontainertools_impl.h
@@ -254,6 +254,13 @@ void q_relocate_overlap_n(T *first, N n, T *d_first)
}
}
+template <typename T>
+struct ArrowProxy
+{
+ T t;
+ T *operator->() noexcept { return &t; }
+};
+
template <typename Iterator>
using IfIsInputIterator = typename std::enable_if<
std::is_convertible<typename std::iterator_traits<Iterator>::iterator_category, std::input_iterator_tag>::value,