写在前面 C++ Standard Library For efficiency reasons, STL is not object-oriented: Makes little use of inheritance, and Makes no use of virtual functions STL是c++的精华,开始前先在此提一下. 有助于总体理解的链接:[C++ STL] 各容器简单介绍 The Standard Template Library (STL) is a part of t…
std::list template < class T, class Alloc = allocator > class list; List Lists are sequence containers that allow constant time insert and erase operations anywhere within the sequence, and iteration in both directions. List containers are implement…
std::forward_list template < class T, class Alloc = allocator > class forward_list; Forward list Forward lists are sequence containers that allow constant time insert and erase operations anywhere within the sequence. Forward lists are implemented a…
std::deque template < class T, class Alloc = allocator > class deque; Double ended queue deque means double enden queue; deque (usually pronounced like "deck") is an irregular acronym of double-ended queue. Double-ended queues are sequence…
因此在实际使用时,如何选择这三个容器中哪一个,应根据你的需要而定,一般应遵循下面 的原则: 1.如果你需要高效的随即存取,而不在乎插入和删除的效率,使用vector 2.如果你需要大量的插入和删除,而不关心随即存取,则应使用list 3.如果你需要随即存取,而且关心两端数据的插入和删除,则应使用deque. MSDN: 1. Introduction The STL vector class is a template class of sequence containers tha…
std::list::erase Erase elements Removes from the list container either a single element (position) or a range of elements ([first,last)).This effectively reduces the container size by the number of elements removed, which are destroyed.Unlike other s…
[C++ 中文手册]即将完成 内容包含C++11,历时一年,日夜赶工,即将完成! 该参考手册主要由以下四部份内容组成: C++ 语言 C++ 继承了 C 语言 的大部分语法,并在其基础上修改或增加部分语义,包括:操作符及操作符重载(Operators and operator overloading).内存管理(Memory management).模板(Templates).对象(Objects).多态(Polymorphism).(暂未开始) 标准 C++ 库 C++ 标准库提供了常用算法或…
1. compared to prefix ++, postfix increment needs one more step to create a temporary variable? what's more , the return type is not reference, there will be another temp var being created to store the return value. int & operator++(int &a) { +…