boost tuple Vs stl pair

R

Rui Maciel

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
 
S

Sherm Pendley

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.

sherm--
 
R

Rui Maciel

Sherm said:
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
 
R

Rui Maciel

Leigh said:
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
 
J

Jeff Flinn

Rui said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top