From 9bfc8f348d39a3606847e2bc2e070bf7cdccc99e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 28 Jan 2022 00:54:32 +0100 Subject: [PATCH] QFlatMap: add full is_transparent support [2/3]: shuffle functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Fabian Kosmale Reviewed-by: Jörg Bornemann --- src/corelib/tools/qflatmap_p.h | 42 +++++++++++++++------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/src/corelib/tools/qflatmap_p.h b/src/corelib/tools/qflatmap_p.h index 5c2aadb4d3f..7e8b230fee6 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 = nullptr> void initWithRange(InputIt first, InputIt last) {