
David Abrahams <dave@boost-consulting.com> writes:
Edd Dawson <edd@nunswithguns.net> writes:
Hello all,
I have the following:
template<typename T> void f() { /* ... */ }
typedef boost::mpl::vector<int, long, double> my_vec;
I'm looking for a way to call f<T>() for all types T in my_vec. I initially hoped that either an mpl algorithm or fusion::for_each might be able to accomplish this for me, but after reading through their docs this doesn't appear to be the case.
struct call_f { template <class Wrapper> void operator()(Wrapper) Sorry, it's missing a "const" right here--^^^^ { f<typename Wrapper::type>(); } };
mpl::for_each<my_vec, mpl::identity<_> >(call_f());
-- Dave Abrahams Boost Consulting www.boost-consulting.com