forked from qt-creator/qt-creator
TaskTree: Use find_if & erase
It's enough to remove just one item, as it's guaranteed that items are unique inside the m_children vector. This should fix the following warning: "ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]". Change-Id: Iae8a11d1f12cd28ef3c4ae4363a4bdc3dbfe31e6 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1725,9 +1725,11 @@ bool TaskRuntimeContainer::updateSuccessBit(bool success)
|
||||
|
||||
void TaskRuntimeContainer::deleteChild(TaskRuntimeNode *node)
|
||||
{
|
||||
std::remove_if(m_children.begin(), m_children.end(), [node](const auto &ptr) {
|
||||
const auto it = std::find_if(m_children.cbegin(), m_children.cend(), [node](const auto &ptr) {
|
||||
return ptr.get() == node;
|
||||
});
|
||||
if (it != m_children.cend())
|
||||
m_children.erase(it);
|
||||
}
|
||||
|
||||
SetupResult TaskTreePrivate::start(TaskRuntimeContainer *container)
|
||||
|
Reference in New Issue
Block a user