Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

boost tuple Vs stl pair

3 views
Skip to first unread message

Rui Maciel

unread,
Jan 6, 2010, 2:48:27 PM1/6/10
to
If you are faced with the need for a one-off, temporary tuple object to store a
pair of objects, between boost's tuple and stl's pair, what is the best library for
the job?


Thanks in advance,
Rui Maciel

Leigh Johnston

unread,
Jan 6, 2010, 3:19:54 PM1/6/10
to
"Rui Maciel" <rui.m...@gmail.com> wrote in message
news:4b44e908$0$9004$a729...@news.telepac.pt...

> If you are faced with the need for a one-off, temporary tuple object to
> store a
> pair of objects, between boost's tuple and stl's pair, what is the best
> library for
> the job?
>

It all depends if you want a boost dependency or not. If you are already
using boost it makes no difference but even then I would still use the
std::pair in preference to a tuple of two items.

/Leigh

Sherm Pendley

unread,
Jan 6, 2010, 6:19:33 PM1/6/10
to
On Jan 6, 2:19 pm, "Leigh Johnston" <le...@i42.co.uk> wrote:
> "Rui Maciel" <rui.mac...@gmail.com> wrote in message

Yeah, if you're trying to get 1st place during amateur hour.

sherm--

Leigh Johnston

unread,
Jan 6, 2010, 8:54:17 PM1/6/10
to

> Yeah, if you're trying to get 1st place during amateur hour.
>
> sherm--

huh?

Rui Maciel

unread,
Jan 6, 2010, 7:28:58 PM1/6/10
to
Sherm Pendley wrote:

>> It all depends if you want a boost dependency or not. If you are already
>> using boost it makes no difference but even then I would still use the
>> std::pair in preference to a tuple of two items.
>>
>> /Leigh
>
> Yeah, if you're trying to get 1st place during amateur hour.

In your opinion, what's the relation between std::pair and a "1st place during amateur hour" ?


Rui Maciel

Rui Maciel

unread,
Jan 7, 2010, 7:28:44 AM1/7/10
to
Leigh Johnston wrote:

> It all depends if you want a boost dependency or not. If you are already
> using boost it makes no difference but even then I would still use the
> std::pair in preference to a tuple of two items.

The added dependency is indeed a negative point. Nonetheless, other than that, is
there anything that makes one of those libraries better than the other?


Rui Maciel

Jeff Flinn

unread,
Jan 7, 2010, 8:17:52 AM1/7/10
to
Rui Maciel wrote:
> Leigh Johnston wrote:
>
>> It all depends if you want a boost dependency or not. If you are already
>> using boost it makes no difference but even then I would still use the
>> std::pair in preference to a tuple of two items.
>
> The added dependency is indeed a negative point. Nonetheless, other than that, is

IIRC, tuple is available in std::tr1 on some compilers.

> there anything that makes one of those libraries better than the other?

Depends on the usage. The pairs first/second members may be easier to
comprehend, tuple's get<n> may be more amenable to template coding, and
of course is extensible beyond a pair.

Jeff

0 new messages