1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Pass functor via reference to avoid costly copies

This commit is contained in:
Ivan Savenko
2023-11-18 19:43:11 +02:00
parent f5a64a0ac5
commit b58301849b
10 changed files with 17 additions and 17 deletions

View File

@@ -562,14 +562,14 @@ int32_t BattleInfo::getActiveStackID() const
return activeStack;
}
TStacks BattleInfo::getStacksIf(TStackFilter predicate) const
TStacks BattleInfo::getStacksIf(const TStackFilter & predicate) const
{
TStacks ret;
vstd::copy_if(stacks, std::back_inserter(ret), predicate);
return ret;
}
battle::Units BattleInfo::getUnitsIf(battle::UnitFilter predicate) const
battle::Units BattleInfo::getUnitsIf(const battle::UnitFilter & predicate) const
{
battle::Units ret;
vstd::copy_if(stacks, std::back_inserter(ret), predicate);