首页 > 其他 > 详细

STL扩展容器

时间:2015-10-18 21:27:17      阅读:334      评论:0      收藏:0      [点我收藏+]

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中.

  

STL扩展容器

原文:http://www.cnblogs.com/roger9567/p/4890046.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!