template <class Key, class Value, class KeyOfValue, class Compare,
class Alloc = alloc>
class rb_tree {}
型别说明:Key 键值类型
Value 元素型别
KeyOfValue 仿函数,由元素型别得出键值型别
Comapre 仿函数,比较键值
Alloc 空间配置器
template <class Key, class T, class Compare = less<Key>, class Alloc = alloc>
class map {
typedef rb_tree<key_type, value_type,
select1st<value_type>, key_compare, Alloc> rep_type;
rep_type t;
}
型别说明:Key 键值型别
T 实值型别
Comapre 仿函数,键值比较
Alloc 空间配置器
template <class Key, class Compare = less<Key>, class Alloc = alloc>
class set {
typedef rb_tree<key_type, value_type,
identity<value_type>, key_compare, Alloc> rep_type;
rep_type t;
}
型别说明:Key 键值型别(也是实值型别)
Comapre 仿函数,键值比较
Alloc 空间配置器
///以上以rb-tree为底层机制,一下以hash-table为底层机制
template <class Value, class Key, class HashFcn,
class ExtractKey, class EqualKey,
class Alloc>
class hashtable {}
型别说明:Value 元素型别
Key 键值型别
HashFcn 仿函数,由键值确定插入位置
ExtractKey 仿函数,由元素得出键值
EqualKey 仿函数,键值是否相等
Alloc 空间配置器
template <class Key, class T, class HashFcn, class EqualKey,
class Alloc = alloc>
class hash_map
{
private:
typedef hashtable<pair<const Key, T>, Key, HashFcn,
select1st<pair<const Key, T> >, EqualKey, Alloc> ht;
ht rep;
}
型别说明:Key 键值型别
T 实值型别
HashFcn 仿函数,由键值确定插入位置
EqualKey 仿函数,键值是否相等
Alloc 空间配置器
template <class Value, class HashFcn = hash<Value>,
class EqualKey = equal_to<Value>,
class Alloc = alloc>
class hash_set
{
private:
typedef hashtable<Value, Value, HashFcn, identity<Value>,
EqualKey, Alloc> ht;
ht rep;
}
型别说明:Value 键值型别(也是实值型别)
HashFcn 仿函数,由键值确定插入位置
EqualKey 仿函数,键值是否相等
Alloc 空间配置器
关联容器模板型别
最新推荐文章于 2022-05-04 12:53:48 发布