QFlatMap: add full is_transparent support [1/3]: split functions
Extract Methods do_foo(iterator) from their respective foo(Key) methods. This is done in order to separate the common code from the code that will differ in the is_transparent overloads. Leave the function bodies where they previously appeared, for easier reviewing. Pick-to: 6.3 Change-Id: I49f41f9121a047df696f39daeaa0a9da6a16dddb Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>bb10
parent
f08f28548a
commit
7b7c3355f2
|
|
@ -607,13 +607,19 @@ public:
|
|||
|
||||
bool remove(const Key &key)
|
||||
{
|
||||
auto it = binary_find(key);
|
||||
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)
|
||||
{
|
||||
|
|
@ -623,7 +629,12 @@ public:
|
|||
|
||||
T take(const Key &key)
|
||||
{
|
||||
auto it = binary_find(key);
|
||||
return do_take(binary_find(key));
|
||||
}
|
||||
|
||||
private:
|
||||
T do_take(iterator it)
|
||||
{
|
||||
if (it != end()) {
|
||||
T result = std::move(it.value());
|
||||
erase(it);
|
||||
|
|
@ -631,6 +642,7 @@ public:
|
|||
}
|
||||
return {};
|
||||
}
|
||||
public:
|
||||
|
||||
bool contains(const Key &key) const
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue