1 #ifndef CommonToolsUtilsExpressionEvaluatorTemplates_H
2 #define CommonToolsUtilsExpressionEvaluatorTemplates_H
12 template<
typename Ret,
typename...
Args>
18 template<
typename Object>
20 virtual bool eval(Object
const&)
const = 0;
23 template<
typename Object>
25 virtual double eval(Object
const&)
const =0;
28 template<
typename Object>
31 using Mask = std::vector<bool>;
34 mask.resize(cands.size());
40 template<
typename Object>
45 cands.erase(std::remove_if(cands.begin(),cands.end(),[&](
typename Collection::value_type const &
c){
return !
f(*
c);}),cands.end());
50 template<
typename Object>
53 using Indices = std::vector<unsigned int>;
57 for (
auto const &
c : cands) {
if(
f(*
c)) inds.push_back(i); ++
i; }
65 #endif // CommonToolsUtilsExpressionEvaluatorTemplates_H
std::vector< Object const * > Collection
std::vector< Object const * > Collection
void mask(Collection const &cands, Mask &mask, F f) const
virtual double eval(Object const &) const =0
virtual void eval(Collection &) const =0
std::vector< unsigned int > Indices
virtual void eval(Collection const &, Indices &) const =0
Container::value_type value_type
virtual Ret operator()(Args...) const =0
std::vector< Object const * > Collection
virtual bool eval(Object const &) const =0
void select(Collection &cands, F f) const
virtual void eval(Collection const &, Mask &) const =0
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
void select(Collection const &cands, Indices &inds, F f) const