
Dan wrote:
It occurs to me that it should be possible to manage an mpl::vector of types which are actually functors. [snip] I think it should be easy to create the vector, but how does one construct an object of each type and call operator() on it?
This works: #include <boost/mpl/vector.hpp> #include <boost/mpl/for_each.hpp> #include <boost/bind.hpp> #include <boost/bind/apply.hpp> struct A { void operator()(); }; struct B { void operator()(); }; ... typedef mpl::vector<A, B> v; mpl::for_each<v>(boost::apply<void>()); And you could use boost::bind to pass parameters to the functors: struct A { void operator()(int); }; struct B { void operator()(int); }; ... typedef mpl::vector<A, B> v; mpl::for_each<v>( boost::bind(boost::apply<void>(), _1, 0) ); HTH, -- Daniel Wallin