Even more algorithm usage in ProjectExplorer

Add Utils::transform and anyOf that take a member function pointer.
Remove bestElementOr it's unused.

Use declval<T> in transform's return type, because msvc does evaluate
T() and for types that don't have simple constructor this fails.
Add std::remove_reference since decltype returns a reference for
lvalues.

Change-Id: I22248b226748eeb27af0d300182d574438d7f756
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Daniel Teske
2014-07-07 19:02:26 +02:00
parent 71b56d2b9c
commit eccf1dc1e3
29 changed files with 219 additions and 247 deletions

View File

@@ -37,6 +37,7 @@
#include "target.h"
#include <extensionsystem/pluginmanager.h>
#include <utils/algorithm.h>
using namespace ProjectExplorer;
@@ -121,11 +122,9 @@ bool BuildStepList::isEmpty() const
bool BuildStepList::contains(Core::Id id) const
{
foreach (BuildStep *bs, steps()) {
if (bs->id() == id)
return true;
}
return false;
return Utils::anyOf(steps(), [id](BuildStep *bs){
return bs->id() == id;
});
}
void BuildStepList::cloneSteps(BuildStepList *source)