On 3/16/07, Christian Henning
Hi there, since there is no example in the docs and no test for it. I was wondering how to use fusion's transform metafunction.
Here is what I want to do.
template <typename T> struct add_vector { typedef std::vector<T> type; };
struct A; struct B; struct C;
int main() { typedef fusion::list< A, B, C > types; typedef fusion::transform< types, add_vector<> >::type vector_of_types;
return 0; }
The compiler is complaining that there are too few parameters for add_vector. In MPL you would just add _1 as the template parameter. But this doesn't work for fusion. So, how do I use it?
You need your function add_vector to be a Polymorphic function object.
I think you need something like this:
struct add_vector
{
template <typename T>
struct result
{
typedef std::vector<T> type;
};
};
typedef typename boost::fusion::result_of::transform