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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user