侯捷stl
复合关系(composition) rb-tree -> set/map/multisey/multimap hashtable -> hash_set/hash_map/hash_multiset/hash_multimap deque -> stack/queue vector -> heap/priority_queue
# 1.list
list<Foo>::iterator ite;
(*ite).method(); //reference operator*(){return (*node).data;}
ite->method(); //pointer operator->(){return &(operator*());}
//上面的代码等同于 (*ite).method();
// &(*ite)->method();
# 2.traits
特性、特征、特质 iterator traits用以分离 class iterators 和 non-class iterators traits机必须有能力辨别它所获得的iterator是(1)class iterator T 或是(2)native pointer to T.利用partial specialization(偏特化)可达到目标。 non class(template) iterators 亦即natice pointer,无法定义associated types,但它的associated types 其实很直观。
# 3.queue和stack均使用deque做底层结构
stack和queue都不允许遍历,也不提供iterator。 只允许从头端或者尾端拿数据