summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <[email protected]>2025-11-28 10:32:35 +0100
committerMarc Mutz <[email protected]>2025-11-29 11:40:27 +0100
commit4eb4462b14cc8065e098412d9dd8a1ade90897e2 (patch)
treeabcc1584e48cca830c8a83051b8045aeec122dd1 /src
parent3d75ca4ceb92890184bbfc9814979e7f7f4ec495 (diff)
QFlatMap: use QtPrivate::ArrowProxy instead of own mock_pointer
.. to use a common vocabulary, and share code. Amends 900d4bd29f30effbb5dbb0efa96886af03839a15, which introduced ArrowProxy for use in QKeyValueIterator and QDomNodeList::It. This is just another user I've overlooked up to now. Pick-to: 6.10 6.8 Change-Id: I2c1eecc75a209ce552ddd1fdebfc6da784c83a00 Reviewed-by: MÃ¥rten Nordheim <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qflatmap_p.h29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/corelib/tools/qflatmap_p.h b/src/corelib/tools/qflatmap_p.h
index 50b7c6bd310..5a827fb4148 100644
--- a/src/corelib/tools/qflatmap_p.h
+++ b/src/corelib/tools/qflatmap_p.h
@@ -15,6 +15,7 @@
// We mean it.
//
+#include <QtCore/qcontainertools_impl.h>
#include "qlist.h"
#include <QtCore/qtclasshelpermacros.h>
#include "private/qglobal_p.h"
@@ -70,35 +71,11 @@ public:
}
};
-namespace qflatmap {
-namespace detail {
-template <class T>
-class QFlatMapMockPointer
-{
- T ref;
-public:
- QFlatMapMockPointer(T r)
- : ref(r)
- {
- }
-
- T *operator->()
- {
- return &ref;
- }
-};
-} // namespace detail
-} // namespace qflatmap
-
template<class Key, class T, class Compare = std::less<Key>, class KeyContainer = QList<Key>,
class MappedContainer = QList<T>>
class QFlatMap : private QFlatMapValueCompare<Key, T, Compare>
{
static_assert(std::is_nothrow_destructible_v<T>, "Types with throwing destructors are not supported in Qt containers.");
-
- template<class U>
- using mock_pointer = qflatmap::detail::QFlatMapMockPointer<U>;
-
public:
using key_type = Key;
using mapped_type = T;
@@ -121,7 +98,7 @@ public:
using difference_type = ptrdiff_t;
using value_type = std::pair<const Key, T>;
using reference = std::pair<const Key &, T &>;
- using pointer = mock_pointer<reference>;
+ using pointer = QtPrivate::ArrowProxy<reference>;
using iterator_category = std::random_access_iterator_tag;
iterator() = default;
@@ -253,7 +230,7 @@ public:
using difference_type = ptrdiff_t;
using value_type = std::pair<const Key, const T>;
using reference = std::pair<const Key &, const T &>;
- using pointer = mock_pointer<reference>;
+ using pointer = QtPrivate::ArrowProxy<reference>;
using iterator_category = std::random_access_iterator_tag;
const_iterator() = default;