Boost logo

Boost :

From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2007-07-07 00:36:28


On 06/07/07, Dennis D Bingaman <ddbingaman_at_[hidden]> wrote:
> I have been using the STL for some time now and have been investigating
> possible use of the boost libraries in future projects. The most useful
> library I have found so far was the boost::lamda library. I was reading
> the documentation and experimenting around with the boost::tuples library.
> The documentation is excellent and very complete and now I understand how
> to create tuples and maybe use them is some limited way. Thing is, I
> can't seem to grasp what advantages there are of tuples over structures
> and classes? Can someone tell me; what are the benefits of tuples over
> structures or classes?
>
You might want to look into a language such as ML that has both
records (like structs) and tuples built-in, and see where they use
which.

I think Jarrad Waterloo's explanation is good though. Tuples are
great when you need a compound type for some reason, such as returning
more than one value from a function, like a map's insert, but that
compound type itself is unimportant. Those situations are often also
those where the ability to tie comes in very handy. (Which is pretty
much just an emulation of the pattern matching in something like ML.)

~ Scott McMurray


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk