diff options
author | Marc Mutz <[email protected]> | 2024-02-13 11:57:39 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <[email protected]> | 2024-02-18 18:37:32 +0000 |
commit | cbf90b6304b96158e239c9b58555109f8b5ca67a (patch) | |
tree | 1cac84f44e155020840dcf1768c5886725b2cac5 | |
parent | 08da29e0dc1b68deba26ed210a766163901b8b9e (diff) |
QVarLengthArray: give the default Prealloc a name
... and use that in QVarLengthFlatMap's definition in lieu of a magic
constant.
Amends d4611ba3a5b46ee790e6c790ef6c3d771d3507ee.
Pick-to: 6.2
Change-Id: I369f31b643789075ef6c14669b8b794ed0b3bbb1
Reviewed-by: Fabian Kosmale <[email protected]>
(cherry picked from commit c30195a95e751552a39f99dd5833ebf722d11bc1)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
(cherry picked from commit aea4e9788ab45df63dc14000321c7743dc9f3ab2)
(cherry picked from commit 823a9677b42ecf75baf558f250a1bd0a79a89322)
-rw-r--r-- | src/corelib/tools/qcontainerfwd.h | 3 | ||||
-rw-r--r-- | src/corelib/tools/qflatmap_p.h | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/tools/qcontainerfwd.h b/src/corelib/tools/qcontainerfwd.h index 67b8d7f4529..dfd7bedc1f5 100644 --- a/src/corelib/tools/qcontainerfwd.h +++ b/src/corelib/tools/qcontainerfwd.h @@ -25,7 +25,8 @@ using QPair = std::pair<T1, T2>; template <typename T> class QQueue; template <typename T> class QSet; template <typename T> class QStack; -template <typename T, qsizetype Prealloc = 256> class QVarLengthArray; +constexpr qsizetype QVarLengthArrayDefaultPrealloc = 256; +template <typename T, qsizetype Prealloc = QVarLengthArrayDefaultPrealloc> class QVarLengthArray; template <typename T> class QList; class QString; #ifndef Q_QDOC diff --git a/src/corelib/tools/qflatmap_p.h b/src/corelib/tools/qflatmap_p.h index 754b6c3a7a9..b3f42317925 100644 --- a/src/corelib/tools/qflatmap_p.h +++ b/src/corelib/tools/qflatmap_p.h @@ -1099,7 +1099,9 @@ private: containers c; }; -template<class Key, class T, qsizetype N = 256, class Compare = std::less<Key>> +template <class Key, class T, + qsizetype N = QVarLengthArrayDefaultPrealloc, + class Compare = std::less<Key>> using QVarLengthFlatMap = QFlatMap<Key, T, Compare, QVarLengthArray<Key, N>, QVarLengthArray<T, N>>; QT_END_NAMESPACE |