Team LiB
Previous Section Next Section

Defined Terms


associative array(关联数组)

Array whose elements are indexed by key rather than positionally. We say that the array maps a key to its associated value.


associative container(关联容器)

A type that holds a collection of objects that supports efficient lookup by key.



Type defined by the associative containers that is the type for the keys used to store and retrieve values. For a map, key_type is the type used to index the map. For set, key_type and value_type are the same.

关联容器定义的类型,表示该容器在存储或读取值时所使用的键的类型。对于 map 容器,key_type 是用于索引该容器的类型。对于 set 容器,key_typevalue_type 相同。


Associative container type that defines an associative array. Like vector, map is a class template. A map, however, is defined with two types: the type of the key and the type of the associated value. In a map a given key may appear only once. Each key is associated with a particular value. Dereferencing a map iterator yields a pair that holds a const key and its associated value.

定义关联数组的关联容器类型。与 vector 容器一样,map 也是类模板。但是,map 容器定义了两种类型:键类型及其关联的值类型。在 map 中,每个键只能出现一次,并关联某一具体的值。对 map 容器的迭代器进行解引用将获得一个 pair 对象,该对象存储了一个 const 键和它所关联的值。


Type defined by map and multimap that is the type for the values stored in the map.

mapmultimap 容器定义的类型,表示在 map 容器中存储的值的类型。


Associative container similar to map except that in a multimap, a given key may appear more than once.

类似 map 的关联容器。在 multimap 容器中,一个键可以出现多次。


Associative container type that holds keys. In a multiset, a givenkey may appear more than once.

只存储键的关联容器类型。在 multiset 容器中,一个键可以出现多次。


Type that holds two public data members named first and second. The pair type is a template type that takes two type parameters that are used as the types of these members.

一种类型,有两个 public 数据成员,分别名为 firstsecondpair 类型是带有两个类型形参的模板类型,它的类型形参用作数据成员的类型。


Associative container that holds keys. In a set, a given key may appear only once.

只存储键的关联容器。在 set 容器中,一个键只能出现一次。

strict weak ordering(严格弱排序)

Relationship among the keys used in an associative container. In a strict weak ordering, it is possible to compare any two values and determine which of the two is less than the other. If neither value is less than the other, then the two values are considered equal. See Section 10.3.1 (p. 360).

关联容器所使用的键之间的比较关系。在这种关系下,任意两个元素都可比较,并能确定两者之间谁比谁小。如果两个值都不比对方小,则这两个值相等,详见第 10.3.1 节


The type of the element stored in a container. For set and multiset, value_type and key_type are the same. For map and multimap, this type is a pair whose first member has type const key_type and whose second member has type mapped_type.

存储在容器中的元素的类型。对于 setmultiset 容器,value_typekey_type 相同。而对于 mapmultimap 容器,该类型为 pair 类型,它的 first 成员是 const key_type 类型,second 成员则是 mapped_type 类型。

* operator(解引用操作符)

The dereference operator when applied to a map, set, multimap, or multiset iterator yields a value_type. Note, that for map and multimap the value_type is a pair.

用于 mapsetmultimapmultiset 迭代器时,解引用操作符将生成一个 value_type 类型的值。注意,对于 mapmultimap 容器,value_typepair 类型。

[] operator(下标操作符)

Subscript operator. When applied to a map, [] takes an index that must be a key_type (or type that can be converted to key_type) value. Yields a mapped_type value.

下标操作符。对 map 容器使用下标操作符时,[] 中的索引必须是 key_type 类型(或者是可以转换为 key_type 的类型)的值;该运算生成 mapped_type 类型的值。

Team LiB
Previous Section Next Section