Boost logo

Boost Users :

Subject: Re: [Boost-users] [Tuple] What's the point?
From: Joel de Guzman (joel_at_[hidden])
Date: 2009-07-10 04:31:04


Robert Jones wrote:
> I know that sounds like a slightly flippant question, but I really don't
> get it.
>
> I've used tuples a few times, always for the multiple return value
> behaviour using tie( ), but
> in the end it always seems to be a better solution to use a struct.
> Code like
>
> t.get<1>( ) = "fred";
>
> is a bit non-obvious, compared to
>
> t.forename = "fred";
>
> So have I entirely missed the point of tuples?

For one, a struct is not generic. For example, there is no
generic way to do a for_each on each element of all structs.

Regards,

-- 
Joel de Guzman
http://www.boostpro.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