mirror of https://github.com/qt/qtbase.git
QFlatMap: add an alias for using QVarLengthArrays
... in an attempt to foster the use of this data structure by making it less onerous to spell. Pick-to: 6.3 6.2 Change-Id: Ib9d17029c75278edde6ba90f65f68af179a6d230 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
234e0eadc8
commit
d4611ba3a5
|
@ -993,6 +993,9 @@ private:
|
||||||
containers c;
|
containers c;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class Key, class T, qsizetype N = 256, class Compare = std::less<Key>>
|
||||||
|
using QVarLengthFlatMap = QFlatMap<Key, T, Compare, QVarLengthArray<Key, N>, QVarLengthArray<T, N>>;
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QFLATMAP_P_H
|
#endif // QFLATMAP_P_H
|
||||||
|
|
|
@ -558,8 +558,7 @@ void tst_QFlatMap::viewIterators()
|
||||||
|
|
||||||
void tst_QFlatMap::varLengthArray()
|
void tst_QFlatMap::varLengthArray()
|
||||||
{
|
{
|
||||||
using Map = QFlatMap<int, QByteArray, std::less<int>,
|
using Map = QVarLengthFlatMap<int, QByteArray, 1024>;
|
||||||
QVarLengthArray<int, 1024>, QVarLengthArray<QByteArray, 1024>>;
|
|
||||||
Map m{ { 2, "twee" } };
|
Map m{ { 2, "twee" } };
|
||||||
m.insert(1, "een");
|
m.insert(1, "een");
|
||||||
m.remove(1);
|
m.remove(1);
|
||||||
|
|
Loading…
Reference in New Issue