From cbf90b6304b96158e239c9b58555109f8b5ca67a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 13 Feb 2024 11:57:39 +0100 Subject: 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 (cherry picked from commit c30195a95e751552a39f99dd5833ebf722d11bc1) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit aea4e9788ab45df63dc14000321c7743dc9f3ab2) (cherry picked from commit 823a9677b42ecf75baf558f250a1bd0a79a89322) --- src/corelib/tools/qcontainerfwd.h | 3 ++- 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; template class QQueue; template class QSet; template class QStack; -template class QVarLengthArray; +constexpr qsizetype QVarLengthArrayDefaultPrealloc = 256; +template class QVarLengthArray; template 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> +template > using QVarLengthFlatMap = QFlatMap, QVarLengthArray>; QT_END_NAMESPACE -- cgit v1.2.3