2007-07-19

boost::tuples

To my surprise, today is the first time I've seen boost's tuples. They are actually pretty cool.
Remember the matlab's multiple return values [a,b] = func(c,d) semantics?

Now in C++, with a few cool boost::tuples:
int i; char c; double d;
tie(i, c, d) = make_tuple(1,'a', 5.5);
For the rest, go to tuples reference.

Unfortunately the boost guys have completely missed the idea of physical units recently, but that's a whole different story.

1 comment:

artyom said...

There is a slight difference between matlab and C++.

In matlab there are no parameters that are passed by reference -- all by value.Thus you need this type of an assignment. This is not corrent in case of C++.

So I don't think it so cool.

BTW: C Rulez ;)