summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qflatmap_p.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-01-28 00:54:32 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-01-29 20:04:24 +0100
commit9bfc8f348d39a3606847e2bc2e070bf7cdccc99e (patch)
tree830e66bfcce755fcbb75756ef98ec6256e144e6e /src/corelib/tools/qflatmap_p.h
parent7e591453be37caf4d8e2bcb7ebc6b706b84f50be (diff)
QFlatMap: add full is_transparent support [2/3]: shuffle functions
Move the do_{remove,take}() functions into the private section, cleaning up after the previous step. Pick-to: 6.3 Change-Id: I3325336458b34e7f376b42bfe68355d93ff4ce70 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/corelib/tools/qflatmap_p.h')
-rw-r--r--src/corelib/tools/qflatmap_p.h42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/corelib/tools/qflatmap_p.h b/src/corelib/tools/qflatmap_p.h
index 5c2aadb4d3..7e8b230fee 100644
--- a/src/corelib/tools/qflatmap_p.h
+++ b/src/corelib/tools/qflatmap_p.h
@@ -610,17 +610,6 @@ public:
return do_remove(binary_find(key));
}
-private:
- bool do_remove(iterator it)
- {
- if (it != end()) {
- erase(it);
- return true;
- }
- return false;
- }
-public:
-
iterator erase(iterator it)
{
c.values.erase(toValuesIterator(it));
@@ -632,18 +621,6 @@ public:
return do_take(binary_find(key));
}
-private:
- T do_take(iterator it)
- {
- if (it != end()) {
- T result = std::move(it.value());
- erase(it);
- return result;
- }
- return {};
- }
-public:
-
bool contains(const Key &key) const
{
return binary_find(key) != end();
@@ -832,6 +809,25 @@ public:
}
private:
+ bool do_remove(iterator it)
+ {
+ if (it != end()) {
+ erase(it);
+ return true;
+ }
+ return false;
+ }
+
+ T do_take(iterator it)
+ {
+ if (it != end()) {
+ T result = std::move(it.value());
+ erase(it);
+ return result;
+ }
+ return {};
+ }
+
template <class InputIt, is_compatible_iterator<InputIt> = nullptr>
void initWithRange(InputIt first, InputIt last)
{