STL 简述

STL是Standard Template Library的简称,中文名标准模板库。Library包括:

  • A pair class(pairs of anything, int/int, int/char, ,etc)
  • Containers
    • Vector(expandable array)
    • Deque(expandable array, expandable at both ends)
    • List(double-linked)
    • Sets and Maps
  • Basic Algorithms(sort, search, etc)
    STL包含在std的名字命名空间(namespace)里。
#include 
#include 
using namespace std;

int main()
{
    vector<int> x;
    for(int i=0;i<1000;i++)
        x.push_back(i);
    vector<int>::iterator p;
    for(p=x.begin();pcout<<*p<<" ";
    return 0;
}

你可能感兴趣的:(c++)