My fault. I was using forward class declarations instead of class
definitions. This works now:
#include <vector>
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
using namespace boost;
template <typename T>
struct add_vector
{
typedef std::vector<T> type;
};
struct A { void print() { cout << "A" << endl; }};
struct B { void print() { cout << "B" << endl; }};
struct C { void print() { cout << "C" << endl; }};
struct create_empty_vec
{
template< class T >
std::vector<T> operator()( T& t ) const
{
return std::vector<T>();
}
};
struct add_one
{
template< class T >
void operator()( T& vec ) const
{
vec.push_back( T::value_type() );
}
};
struct print
{
template< class T >
void operator()( T& vec ) const
{
vec[0].print();
}
};
int main()
{
typedef mpl::list< A, B, C > _types_;
typedef mpl::transform1< _types_, add_vectormpl::_1 >::type
_mpl_list_of_vectors_;
typedef fusion::result_of::as_list<_mpl_list_of_vectors_>::type
_fusion_list_of_vectors_;
_fusion_list_of_vectors_ vectors;
fusion::for_each( vectors, create_empty_vec() );
fusion::for_each( vectors, add_one() );
fusion::for_each( vectors, print() );
return 0;
}
Sorry for the noise,
Christian