14 template <
typename Units,
typename UnaryPredicate>
16 std::vector<typename std::decay<Units>::type::value_type> result;
17 std::copy_if(units.begin(), units.end(), std::back_inserter(result), pred);
21 template <
typename Units,
typename UnaryPredicate>
22 inline auto countUnits(Units&& units, UnaryPredicate pred) {
23 return std::count_if(units.begin(), units.end(), pred);
27 std::vector<tc::Unit>
const& units,
28 tc::BW::UnitType type) {
30 units, [type](
tc::Unit const& u) {
return u.
type == type; });
34 std::vector<tc::Unit>
const& units,
35 std::vector<tc::BW::UnitType>
const& types) {
37 for (
auto type : types) {
47 std::vector<tc::Unit>
const& units,
48 std::function<
bool(tc::BW::UnitType)>
const& pred) {
50 auto ut = tc::BW::UnitType::_from_integral_nothrow(u.
type);
auto countUnits(Units &&units, UnaryPredicate pred)
Definition: filter.h:22
int32_t type
Definition: frame.h:87
auto filterUnits(Units &&units, UnaryPredicate pred)
Definition: filter.h:15
std::vector< tc::Unit > filterUnitsByType(std::vector< tc::Unit > const &units, tc::BW::UnitType type)
Definition: filter.h:26
Main namespace for bot-related code.
Definition: areainfo.cpp:17
std::vector< tc::Unit > filterUnitsByTypes(std::vector< tc::Unit > const &units, std::vector< tc::BW::UnitType > const &types)
Definition: filter.h:33