//Using a standard functor struct MatchString { MatchString(const std::string& s) : s_(s) {} bool operator()(const Type& obj) const { return obj.getName() == s_; } private: const std::string& s_; };