STL - vector

构造函数
vector();
vector( size_type num, const TYPE &val );
vector( const vector &from );
vector( input_iterator start, input_iterator end );

运算符
[], =, ==, !=, >, >=, <, <=
两个vector相等:所有相同位置的元素相等
两个vector大小比较:按照词典规则

迭代器
iterator begin();
iterator end();
reverse_iterator rbegin();
reverse_iterator rend();

访问
TYPE at( size_type loc );
TYPE front();
TYPE back();

新增
void push_back( const TYPE &val );
iterator insert( iterator loc, const TYPE &val );
void insert( iterator loc, size_type num, const TYPE &val );
void insert( iterator loc, input_iterator start, input_iterator end );

移除
void pop_back();
iterator erase( iterator loc );
iterator erase( iterator start, iterator end );
void clear();

交换
void swap( vector &from );

大小
bool empty();
size_type size();
void resize( size_type num, const TYPE& val = TYPE() );

容量
size_type capacity();
void reserve( size_type size );

posted @ 2013-05-08 21:21  Leung文  阅读(185)  评论(0编辑  收藏  举报