What is std::pair?

前端 未结 10 1735
面向向阳花
面向向阳花 2020-12-12 19:07

What is std::pair for, why would I use it, and what benefits does boost::compressed_pair bring?

10条回答
  •  爱一瞬间的悲伤
    2020-12-12 19:46

    Sometimes there are two pieces of information that you just always pass around together, whether as a parameter, or a return value, or whatever. Sure, you could write your own object, but if it's just two small primitives or similar, sometimes a pair seems just fine.

提交回复
热议问题