STL(1) 指针迭代器

STL的一个主要特性——它不只是能够用于它自己的类类型,而且也能用于任何C或C++类型。

#include <iostream>
#include <algorithm> //为了避免和其他头文件冲突, STL的头文件不再使用常规的.h扩展

using namespace std;

#define SIZE 100
int 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;
    else
        cout<<*ip<<"   found in array"<<endl;
    getchar();
    return 0;
}
原文地址:https://www.cnblogs.com/dLong/p/3439389.html