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.6 6.5 6.2
Change-Id: I369f31b643789075ef6c14669b8b794ed0b3bbb1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c30195a95e751552a39f99dd5833ebf722d11bc1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-02-13 11:57:39 +01:00 committed by Qt Cherry-pick Bot
parent c3aa052942
commit aea4e9788a
2 changed files with 5 additions and 2 deletions

View File

@ -30,7 +30,8 @@ template <typename T> class QQueue;
template <typename T> class QSet;
template <typename T, std::size_t E = std::size_t(-1) /* = std::dynamic_extent*/> class QSpan;
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

View File

@ -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