Boost logo

Boost Users :

From: Christian Henning (chhenning_at_[hidden])
Date: 2006-08-15 15:14:12


Hi there, just trying to figure out how to put together a tuple type
at compile type? Please consider the following code:

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;
};

template< class S >
void create_tuple( S s )
{
   /// create tuple_type

   map< tuple_type, unsigned int > map;

   map[ make_tuple( s ) ] = 99;
}

The template parameter S will only be one of above defined structs.
Clearly, I need to loop over S::num_values to create the tuple type.
But how do I do that?

Thanks ahead,
Christian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net