Using mpl to instantiate template function
2 Jul
2009
2 Jul
'09
11:16 a.m.
Is there a type-only based way (e.g. with fold) of getting mpl to stamp out template functions for a collection of types? For example, this appears to work using mpl::for_each template <typename T> void Foo(); typedef mpl::vector<t1, t2, t3> Types; struct StampOut { template <typename T void operator()(const T *) const { Foo<T>(); } }; void dummy_() { mpl::for_each<Types>(Types, add_pointer<mpl::_1> >(StampOut()); } However, it requires the "dummy_" function to force instantiation. Is there an alternative trick?
5559
Age (days ago)
5559
Last active (days ago)
0 comments
1 participants
participants (1)
-
Richard Hazlewood