ref. 《STL 源码剖析》
STL 6大组件
- 容器 containers 一种class template 各种数据结构
序列式 vector list deque stack queue heap priority_queue slist
关联式 tree RB-tree set map multitest multimap hashtable hash_set hash_map hash_multiset hash_multimap - 算法 algorithms 一种function template sort search copy erase…
容器与算法之间胶合剂,所谓 ”泛型指针”
五种类型以及衍生变化 - 迭代器 iterators 所有STL 容器都有自己专属的迭代器。原生指针也是一种迭代器。
- 仿函数 functors 一种重载了operator()的class 或者 class template 一般函数指针可视为狭义仿函数
- 配接器 adapters 一种修饰容器or仿函数 or 迭代器接口的东西
STL提供的queue stack 是一种容器适配器 配置器 allocators 负责空间配置管理 实现了动态空间配置管理释放的class template
hash hash_map unordered_map 区别
http://blog.csdn.net/qq51931373/article/details/44196859- 线程安全的 是共享内存 互斥访问 vevtor
- 非。。。。。。。。。。不互斥访问 arraylist hash_map
http://bbs.csdn.net/topics/300263474
简单的来讲,在多线程情况下 vector.add(e),这样写就好了,如果你用ArrayList.add(e),那么你就得这样
synchronized(ArrayList)
{
ArrayList.add(e)
}
HashMap线程不安全(hash碰撞与扩容导致)