|
Boost Users : |
From: Joel de Guzman (joel_at_[hidden])
Date: 2007-09-04 20:00:38
Graham Reitz wrote:
> One of my colleagues has asked me, "why not use a simple struct over a tuple?"
>
> Unfortunately, I couldn't give a convincing answer, which means I
> probably don't understand tuple well enough.
>
> What is a good way to respond to this? Then we can identify when it
> makes better sense to use a struct versus a tuple.
In a word, "genericity". Yeah, there's no such word in the
english dictionary, but I'm sure you know what I mean. When
you want to treat something in a uniform manner, then you'll
want to use tuples. Tuple genericity is exploited by the
Boost.Fusion library such that you have iterators and
algorithms that work on different tuple types (think STL
for heterogeneous types). And it goes further! In Fusion
a struct is a tuple.
See: http://tinyurl.com/2ypbof
Regards,
-- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
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