Is it possible to make a list out tuple?
typedef std::tuple<int,node*> node;
A run-time equivalent would be:
struct node {
int i;
node* next
};
Update (1)
Since I got a lot of criticism. I'll expand on the question. Originally I just wanted to keep it simple.
(1) I prefer using tuples to structs. one of the reasons is that I use boost fusion for io, algorithms and meta-programming. structs don't have that. for more information on tuples or an equivalent boost::fusion::vector, see http://www.boost.org/doc/libs/1_55_0/libs/fusion/doc/html/fusion/quick_start.html
(2) Specifically, I use a number of structures similar to this one:
struct SLseg{
int edge;
Point lP;
Point rP;
SLseg* above;
SLseg* below;
};
I don't want to write operator<<
for each one of them or use inheritance. boost::fusion's io and pretty-print provide facilities to output the structures given that they are tuples; even if there are stl containers in the tuples.
(3) list is just a simple example. think of having a heterogeneous list where the type is determined using enable_if
with some fusion/mpl algorithms.