摘要: 尽管C++指针也是迭代器,但用的更多的是容器迭代器。但和将迭代器申明为指针变量不同的是,你可以使用容器类方法来获取迭代器对象。两个典型的容器类方法是begin()和end()。它们在大多数容器中表示整个容器范围。 阅读全文
posted @ 2013-11-23 20:48 CJin 阅读(138) 评论(0) 推荐(0)
摘要: STL的一个主要特性——它不只是能够用于它自己的类类型,而且也能用于任何C或C++类型。#include #include //为了避免和其他头文件冲突, STL的头文件不再使用常规的.h扩展using namespace std;#define SIZE 100int iarray[SIZE];int main(){ iarray[20] = 50; int *ip = find(iarray,iarray+SIZE, 50); if (ip == iarray+SIZE) cout<<"50 not found in array"<<endl; 阅读全文
posted @ 2013-11-23 20:33 CJin 阅读(178) 评论(0) 推荐(0)
摘要: http://blog.sina.com.cn/s/articlelist_1633926635_0_1.html 阅读全文
posted @ 2013-11-23 17:36 CJin 阅读(100) 评论(0) 推荐(0)