STL扩展容器

string | array | hash

1. string

  - 可以视为以字符为元素的一种容器, 可以在字符上进行遍历, 提供begin()/end()

  - 为了支持迭代器和迭代器适配器 , string提供了一些操作函数, 如 push_back().

2. array

  - 可以将数组也当作STL容器使用, 但是array并不是class, 没有begin()/end()等成员函数. 

  - 用指针当作迭代器和迭代器适配器.

1 int coll[] = {5,6,2,4,1,3};
2 transform(coll,coll+6,coll,coll,multiplies<int>());
3 copy(coll,coll+6,ostream_iterator<int>(cout," "));

3.hash

  - 一般而言程序库会提供四种hash table: hash_set, hash_multiset, hash_map, hash_multimap.

  - hash table没有在STL中.

  

posted @ 2015-10-18 20:13  roger9567  阅读(147)  评论(0编辑  收藏  举报