Chinaunix首页 | 论坛 | 博客
  • 博客访问: 174340
  • 博文数量: 69
  • 博客积分: 2627
  • 博客等级: 少校
  • 技术积分: 715
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-24 22:37
文章分类

全部博文(69)

文章存档

2017年(3)

2014年(1)

2013年(4)

2012年(6)

2011年(21)

2010年(15)

2009年(19)

我的朋友

分类: C/C++

2009-05-04 10:42:26

stl 之 容器

Standard Library container classes:

----------------------------------------------------------
container class            Description

Sequence containers:
vector                    rapid insertions and deletions at back direct access to any element
deque                     rapid insertions and deletions at front or back direct access to any element
list                      doubly linked list, rapid insertion and deletion anywhere
 
Associative containers:
set                       rapid lookup, no duplicates allowed
multiset                  rapid lookup, duplicates allowed
map                       one-to-one mapping, no duplicates allowed, rapid key-based lookup
multimap                  one-to-many mapping, duplicates allowed, rapid key-based lookup
 
Container adapters:
stack                     last-in, first-out (LIFO)
queue                     first-in, first-out (FIFO)
priority_queue            highest-priority element is always the first element out
 




Common member functions
for all STL containers      Description
-----------------------------------------------------------------------------------
default constructor       A constructor to provide a default initialization of the container.
                          Normally, each container has several constructors that provide
                          different initialization methods for the container.
copy constructor          A constructor that initializes the container to be a copy of
                          an existing container of the same type.
destructor                Destructor function for cleanup after a container
                          is no longer needed.
        *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * 
empty                     Returns true if there are no elements in the container;
                          otherwise, returns false.
size                      Returns the number of elements currently in the container.
operator=                 Assigns one container to another.
operator<                 Returns true if the first container is less than the second container;
                              otherwise, returns false.
operator<=                Returns TRue if the first container is less than or equal to the second container;
                              otherwise, returns false.
operator>                 Returns true if the first container is greater than the second container;
                              otherwise, returns false.
operator>=                Returns true if the first container is greater than or equal to the second
                              container; otherwise, returns false.
operator==                Returns true if the first container is equal to the second container;
                              otherwise, returns false.
operator!=                Returns TRue if the first container is not equal to the second con-tainer;
                              otherwise, returns false.
swap                      Swaps the elements of two containers.

Functions found only in first-class containers:
max_size                  Returns the maximum number of elements for a container.
begin                     The two versions of this function return either an iterator or a const_iterator
                              that refers to the first element of the container.
end                       The two versions of this function return either an iterator or a const_iterator
                              that refers to the next position after the end of the container.
rbegin                    The two versions of this function return either a reverse_iterator or a
                              const_reverse_iterator that refers to the last element of the container.
rend                      The two versions of this function return either a reverse_iterator or a
                              const_reverse_iterator that refers to the next position
                              after the last element of the reversed container.
erase                     Erases one or more elements from the container.
clear                     Erases all elements from the container.
 
 
阅读(502) | 评论(0) | 转发(0) |
0

上一篇:const用法

下一篇:编译预处理指令(收集)

给主人留下些什么吧!~~