What is std::pair?

前端 未结 10 1731
面向向阳花
面向向阳花 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 20:07

    Additional info: boost::compressed_pair is useful when one of the pair's types is an empty struct. This is often used in template metaprogramming when the pair's types are programmatically inferred from other types. At then end, you usually have some form of "empty struct".

    I would prefer std::pair for any "normal" use, unless you are into heavy template metaprogramming.

提交回复
热议问题