Hi Joel,
Oops, that should be
typedef mpl::vector_c consts_type;
typedef fusion::vector vars_type;
vars_type vars;
fusion::joint_view s3(consts_type(), vars);
Anyway, I'm sure you got the point. With our 's3' above, we can,
for exemple, write (using boost::lambda):
fusion::for_each(s3, cout << _1 << endl);
to print all the items.
I just tried your suggestion and it works until the fusion::for_each()
call. There, I get a million compiler errors. I'm sure I'm must
missing something simple here.
This is what I'm doing:
#include <iostream>
#include
#include
#include
#include
#include
using namespace std;
using namespace boost;
using namespace boost::lambda;
struct s1
{
static const int num_values = 1;
int i;
};
struct s2
{
static const int num_values = 2;
int i;
int j;
};
struct s3
{
static const int num_values = 3;
int i;
int j;
int k;
};
struct s4
{
static const int num_values = 4;
int i;
float j;
int k;
double l;
};
template <class S> void doSomething( S& s )
{
typedef mpl::vector_c consts_type;
typedef fusion::vector vars_type;
vars_type vars;
fusion::joint_view view(consts_type(), vars);
fusion::for_each( view, cout << _1 << endl );
}
int _tmain(int argc, _TCHAR* argv[])
{
s4 s;
doSomething( s );
return 0;
}
When I got the CVS head there was no fusion documentation included. Is
that correct?
Greets,
Christian