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>
This commit is contained in:
parent
7e591453be
commit
9bfc8f348d
@ -610,17 +610,6 @@ public:
|
|||||||
return do_remove(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)
|
iterator erase(iterator it)
|
||||||
{
|
{
|
||||||
c.values.erase(toValuesIterator(it));
|
c.values.erase(toValuesIterator(it));
|
||||||
@ -632,18 +621,6 @@ public:
|
|||||||
return do_take(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);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
public:
|
|
||||||
|
|
||||||
bool contains(const Key &key) const
|
bool contains(const Key &key) const
|
||||||
{
|
{
|
||||||
return binary_find(key) != end();
|
return binary_find(key) != end();
|
||||||
@ -832,6 +809,25 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
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>
|
template <class InputIt, is_compatible_iterator<InputIt> = nullptr>
|
||||||
void initWithRange(InputIt first, InputIt last)
|
void initWithRange(InputIt first, InputIt last)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user