在线文档教程

AssociativeContainer

C++概念:关联容器

AssociativeContainer是有序的Container它提供基于键的对象快速查找。

所需

传说

*。

X容器型

X型值

节点句柄与X兼容的Y型的A2值

B可能是X型的Const值

U任意变量名

阿[医]当X支持唯一键时,X类型的Uniq值

阿[医]当X支持多个键时,X类型的EQ值

阿[医]当类型X::Key时,X类型的可能Const值[医]比较::IS[医]透明存在

表示有效范围的i,j InputIterator,并引用隐式可转换为X::value的元素[医]类型

p是一个有效的Const迭代器。

q一个有效的可取消引用的Const迭代器到

r一个有效的可取消引用的迭代器到

中表示有效范围的Q1,Q2迭代器。

ILI类型为std::初始化器的对象[医]列表<值[医]类型>

TA型值::值[医]类型

KA型值X::Key[医]类型

Ca可能满足X::Key类型的值[医]比较

KLA值,使得a相对于c%28r、kl%29被划分,而r的键值e和e在

Ku A值,使得a相对于%21c%28 ku,r%29被划分

对于c%28r,ke%29和%21c%28 ke,r%29,c%28r,ke%29,表示%21c%28ke,r%29

X或STD::分配器使用的存储分配器[医]类型<X::值[医]类型>

一种可转换为A的M分配器

NHA型非参数X::节点[医]类型

expressionreturn typepre/requirementspost/effectscomplexity
X::key_typeKeyKey is Destructiblecompile time
X::key_compareComparecompile time
X::value_comparea type satisfying BinaryPredicatekey_compare for std::set and std::multiset; an ordering relation over Key for std::map and std::multimapcompile time
X(c), X a(ckey_compare is CopyConstructibleConstruct an empty container using a copy of c as key_compconstant
X(), X a;key_compare is CopyConstructibleConstruct an empty container using a Compare() as key_compconstant
X(i, j, c), X a(i, j, ckey_compare is CopyConstructible and value_type is EmplaceConstructible into X from *iConstructs an empty container using a copy of c as key_comp and inserts all elements from the range [i; j)generally N log N, or N if [i, j) is sorted (where N is std::distance(i, j))
X(i, j), X a(i, jkey_compare is CopyConstructible and value_type is EmplaceConstructible into X from *iConstructs an empty container using a Compare() as key_comp and inserts all elements from the range [i; j)generally N log N, or N if [i, j) is sorted according to value_comp() (where N is std::distance(i, j))
X(ilEquivalent to X(il.begin(), il.end()Equivalent to X(il.begin(), il.end()
a = ilX&T is CopyInsertable into X and also CopyAssignableAssign the range [il.begin(), il.end()) into a. Elements of a that were not assigned to are destroyedgenerally N log N, or N if [il.begin(), il.end()) is sorted according to value_comp() (where N is il.size() + a.size())
a.key_comp()X::key_compareThe comparison object with which a was constructed is returned.constant
a.value_comp()X::value_compareAn object of type X::value_compare constructed out of the comparison object is returned.constant

联合容器X那不是std::mapstd::multimap此外,还支持表达式X::map[医]类型,它的返回类型为T,并要求TDestructible,以及编译时的复杂性。

标准库中的联合收货人

setcollection of unique keys, sorted by keys (class template)
multisetcollection of keys, sorted by keys (class template)
mapcollection of key-value pairs, sorted by keys, keys are unique (class template)
multimapcollection of key-value pairs, sorted by keys (class template)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cpPreference.com/w/cpp/概念性/AssociativeContainer