什么是性病::对? [英] What is std::pair?

查看:120
本文介绍了什么是性病::对?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是的std ::对对,为什么我会用它,有什么好处呢的boost :: COM pressed_pa​​ir <​​/ code>带来了什么?

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

推荐答案

性病::对 是分组两个值一起作为一个对象的数据类型。 的std ::地图 用途它键,值对。

std::pair is a data type for grouping two values together as a single object. std::map uses it for key, value pairs.

当你学习 ,你可以检查出 元组 。这就像但是对于分组值任意数量。 元组是TR1的一部分,很多编译器已经包含它与标准库的实现。

While you're learning pair, you might check out tuple. It's like pair but for grouping an arbitrary number of values. tuple is part of TR1 and many compilers already include it with their Standard Library implementations.

此外,结账第1章元组,一书的 C ++标准库扩展:教程和参考的皮特·贝克尔,ISBN-13:9780321412997,对于一个详尽的解释

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.

这篇关于什么是性病::对?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆