What is std::pair for, why would I use it, and what benefits does boost::compressed_pair bring?
What is std::pair for, why would I use it, and what benefits does boost::compressed_pair
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
std::pairis a data type for grouping two values together as a single object.std::mapuses it for key, value pairs.While you’re learning
pair, you might check outtuple. It’s likepairbut for grouping an arbitrary number of values.tupleis part of TR1 and many compilers already include it with their Standard Library implementations.Also, checkout Chapter 1, ‘Tuples,’ of the book The C++ Standard Library Extensions: A Tutorial and Reference by Pete Becker, ISBN-13: 9780321412997, for a thorough explanation.