David Abrahams wrote: > > FWIW, Boost.Function is overkill for many simple cases. This might > be a case where the FS library should just provide a class with a > virtual function: > > struct checker > { > virtual ~checker() {} > virtual bool operator()( std string const& ) = 0; > > shared_ptr<checker> next; // suggested. > };
Boost.Function makes things simpler for the user. enum check_type { check_posix, check_windows, ... }; bool my_name_checker(std::string const & s, check_type t); Compare bind(my_name_checker, _1, check_posix) against struct my_name_checker_: public checker { check_type t_; my_name_checker_(check_type t): t_(t) {} bool operator()( std::string const & s) { return my_name_checker(s, t_); } }; It is still possible to substitute a homegrown function<bool(string)> (or function<bool(char const *)>) equivalent for portability reasons, of course. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost