容器中衍生出的类型:
size_type |
Unsigned integral type large enough to hold size of largest possible container of this container type 无符号整型,足以存储此容器类型的最大可能容器长度 |
iterator |
Type of the iterator for this container type 此容器类型的迭代器类型 |
const_iterator |
Type of the iterator that can read but not write the elements 元素的只读迭代器类型 |
reverse_iterator |
Iterator that addresses elements in reverse order 按逆序寻址元素的迭代器 |
const_reverse_iterator |
Reverse iterator that can read but not write the elements 元素的只读(不能写)逆序迭代器 |
difference_type |
Signed integral type large enough to hold the difference, which might be negative, between two iterators 足够存储两个迭代器差值的有符号整型,可为负数 |
value_type |
Element type 元素类型 |
reference |
Element's lvalue type; synonym for value_type& 元素的左值类型,是 value_type& 的同义词 |
const_reference |
Element's const lvalue type; same as const value_type& 元素的常量左值类型,等效于 const value_type& |
value_type + reference + const_reference 的特殊点:
1.无须直接知道容器元素的真正类型,就能使用它。需要使用元素类型时,只要用 value_type 即可。
2.如果要引用该类型,则通过 reference 和 const_reference 类型实现。
在程序员编写自己的泛型程序时,这些元素相关类型的定义非常有用。
猜测:reference和void * 类似。