之型专题

STL源码笔记之型别提取技法(2)

1.iterator_category     (1)Input Iterator:这种迭代器所指的对象,不允许外接改变,只读。         (2)Output Iterator:只写。     (3)Forward Iterator:允许“写入型”算法在此迭代器所形成的区间上进行读写操作。     (4)Bidirectional Iterator:可双向移动。某些算法需要逆向走访某

STL源码笔记之型别提取技法(1)

STL源码利用Traits类来萃取,模板参数一些型别,我觉得蛮不错,做个笔记。 1.利用function template的参数推导机制 template<class I,class T>Void func_impl(I iter,T t){T tmp;//};template<class I>Void func_impl(I iter){func_impl(iter,*ite