diff --git a/src/corelib/tools/qflatmap_p.h b/src/corelib/tools/qflatmap_p.h index 77864babc3..2c40576f17 100644 --- a/src/corelib/tools/qflatmap_p.h +++ b/src/corelib/tools/qflatmap_p.h @@ -430,6 +430,7 @@ private: public: QFlatMap() = default; +#ifdef QFLATMAP_TEMPORARILY_REMOVED explicit QFlatMap(const key_container_type &keys, const mapped_container_type &values) : c{keys, values} { @@ -465,6 +466,7 @@ public: initWithRange(first, last); ensureOrderedUnique(); } +#endif explicit QFlatMap(Qt::OrderedUniqueRange_t, const key_container_type &keys, const mapped_container_type &values) @@ -506,6 +508,7 @@ public: { } +#ifdef QFLATMAP_TEMPORARILY_REMOVED explicit QFlatMap(const key_container_type &keys, const mapped_container_type &values, const Compare &compare) : value_compare(compare), c{keys, values} @@ -546,6 +549,7 @@ public: initWithRange(first, last); ensureOrderedUnique(); } +#endif explicit QFlatMap(Qt::OrderedUniqueRange_t, const key_container_type &keys, const mapped_container_type &values, const Compare &compare) @@ -685,6 +689,7 @@ public: return value(key); } +#ifdef QFLATMAP_TEMPORARILY_REMOVED std::pair insert(const Key &key, const T &value) { return insert_or_assign(key, value); @@ -704,6 +709,7 @@ public: { return insert_or_assign(std::move(key), std::move(value)); } +#endif template std::pair try_emplace(const Key &key, Args&&...args) @@ -747,6 +753,7 @@ public: return r; } +#ifdef QFLATMAP_TEMPORARILY_REMOVED template = nullptr> void insert(InputIt first, InputIt last) { @@ -772,6 +779,7 @@ public: { insertOrderedUniqueRange(first, last); } +#endif iterator begin() { return { &c, 0 }; } const_iterator begin() const { return { &c, 0 }; } diff --git a/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp b/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp index 11448b33cb..8674734a11 100644 --- a/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp +++ b/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp @@ -44,9 +44,11 @@ class tst_QFlatMap : public QObject { Q_OBJECT private slots: +#ifdef QFLATMAP_TEMPORARILY_REMOVED void constructing(); void constAccess(); void insertion(); +#endif void insertRValuesAndLValues(); void removal(); void extraction(); @@ -63,6 +65,7 @@ private: void transparency_impl(); }; +#ifdef QFLATMAP_TEMPORARILY_REMOVED void tst_QFlatMap::constructing() { using Map = QFlatMap; @@ -164,9 +167,11 @@ void tst_QFlatMap::insertion() QCOMPARE(m.value("narf").data(), "NARFFFFFF"); QCOMPARE(m.value("gnampf").data(), "GNAMPF"); } +#endif void tst_QFlatMap::insertRValuesAndLValues() { +#ifdef QFLATMAP_TEMPORARILY_REMOVED using Map = QFlatMap; const QByteArray foo = QByteArrayLiteral("foo"); const QByteArray bar = QByteArrayLiteral("bar"); @@ -199,6 +204,7 @@ void tst_QFlatMap::insertRValuesAndLValues() } #undef lvalue +#endif } void tst_QFlatMap::extraction() @@ -206,7 +212,7 @@ void tst_QFlatMap::extraction() using Map = QFlatMap; Map::key_container_type expectedKeys = { 1, 2, 3 }; Map::mapped_container_type expectedValues = { "een", "twee", "dree" }; - Map m(expectedKeys, expectedValues); + Map m(Qt::OrderedUniqueRange, expectedKeys, expectedValues); auto keys = m.keys(); auto values = m.values(); QCOMPARE(keys, expectedKeys); @@ -219,7 +225,7 @@ void tst_QFlatMap::extraction() void tst_QFlatMap::iterators() { using Map = QFlatMap; - auto m = Map{ { 1, "foo" }, { 2, "bar" }, { 3, "baz" } }; + auto m = Map{ Qt::OrderedUniqueRange, { { 1, "foo" }, { 2, "bar" }, { 3, "baz" } } }; { // forward / backward Map::iterator a = m.begin(); @@ -365,6 +371,7 @@ void tst_QFlatMap::iterators() void tst_QFlatMap::removal() { +#ifdef QFLATMAP_TEMPORARILY_REMOVED using Map = QFlatMap; Map m({ { 2, "bar" }, { 3, "baz" }, { 1, "foo" } }); QCOMPARE(m.value(2).data(), "bar"); @@ -387,10 +394,12 @@ void tst_QFlatMap::removal() it = m.erase(it); QCOMPARE(it.key(), 2); QVERIFY(!m.contains(1)); +#endif } void tst_QFlatMap::statefulComparator() { +#ifdef QFLATMAP_TEMPORARILY_REMOVED struct CountingCompare { mutable int count = 0; @@ -408,6 +417,7 @@ void tst_QFlatMap::statefulComparator() QCOMPARE(m2.key_comp().count, m1.key_comp().count); m2.insert(m1.begin(), m1.end()); QVERIFY(m2.key_comp().count > m1.key_comp().count); +#endif } void tst_QFlatMap::transparency_using() @@ -439,6 +449,7 @@ void tst_QFlatMap::transparency_struct() template void tst_QFlatMap::transparency_impl() { +#ifdef QFLATMAP_TEMPORARILY_REMOVED using Map = QFlatMap; auto m = Map{ { "one", "een" }, { "two", "twee" }, { "three", "dree" } }; @@ -462,6 +473,7 @@ void tst_QFlatMap::transparency_impl() QVERIFY(m.contains(QLatin1String("one"))); QVERIFY(m.remove(QAnyStringView(u8"one"))); QVERIFY(!m.contains(QLatin1String("one"))); +#endif } void tst_QFlatMap::try_emplace_and_insert_or_assign() @@ -608,6 +620,7 @@ void tst_QFlatMap::try_emplace_and_insert_or_assign() void tst_QFlatMap::viewIterators() { +#ifdef QFLATMAP_TEMPORARILY_REMOVED using Map = QFlatMap; Map m({ { "yksi", "een"}, { "kaksi", "twee" }, { "kolme", "dree" } }); { @@ -652,13 +665,14 @@ void tst_QFlatMap::viewIterators() it--; QCOMPARE(*it, "dree"); } +#endif } void tst_QFlatMap::varLengthArray() { using Map = QVarLengthFlatMap; - Map m{ { 2, "twee" } }; - m.insert(1, "een"); + Map m(Qt::OrderedUniqueRange, { { 2, "twee" } }); + m.insert_or_assign(1, "een"); m.remove(1); QVERIFY(!m.isEmpty()); m.remove(2);