QVarLengthArray: give the default Prealloc a name

... and use that in QVarLengthFlatMap's definition in lieu of a magic
constant.

Amends d4611ba3a5.

Pick-to: 6.7 6.6 6.5 6.2
Change-Id: I369f31b643789075ef6c14669b8b794ed0b3bbb1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
bb10
Marc Mutz 2024-02-13 11:57:39 +01:00
parent 7c9efdf40c
commit c30195a95e
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