21 Aug
2006
21 Aug
'06
11:48 a.m.
David Abrahams
Edd Dawson
writes: Hello all,
I have the following:
template<typename T> void f() { /* ... */ }
typedef boost::mpl::vector
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
>(call_f());
-- Dave Abrahams Boost Consulting www.boost-consulting.com