General Container Concepts
iterator: inputIterator
Assignable
X::value_type
X::reference
X::pointer
X::const_reference
X::const_pointer
X::iterator
X::const_iterator
X::difference_type (int)
X::size_type (unsigned int)
The difference between size and area;
size is the element count of the container
area means how many byte the container occupied.
The basic function of a general container
begin()
end()
size()
max_size()
empty()
swap()
**************************************************
*****************************************************
**************************************************
Forward container
have certain order. so it allow multi-iterators are active
So, it is: Container, Equality comparable, LessThan Comparable.
When refer to the equality and not Equality, it need Equality Comparable Concept
for others like >=, <=, >, <, LessThan comparable is just fine.
Following is the Forward Container in STL
vector
list
slist
deque
set
hash_set
map
hash_map
multiset
hash_multiset
multimap
hash_multimap
**************************************************
*****************************************************
**************************************************
Reversible Container
Bidirectional iterator.
Usable function:
rbegin()
rend()
Model:
vector<double>
list<string>
set<int>
**************************************************
*****************************************************
**************************************************
Random Access container
It doesn't contain List, slist.
**************************************************
*****************************************************
**************************************************
**************************************************
*****************************************************
**************************************************
Sequence
strict linear order.
Forward Container
Functions:
Fill constructor:
X(n, t) fill container with t, n times.
X(n) equal to X(n, T())
Range constructor:
X(i, j) fill the container with the elements between iterator i and j
Insert:
a.insert(p, t) insert t before the iterator p of container a. p would be
invalid sometimes, it depends the container.
Fill Insert:
a.insert(p, n, t)
Range Insert:
a.insert(p, i, j)
Erase:
a.erase(p), return the next element of p or end if p is the last element
Range erase:
a.erase(p, q)
Front:
a.front(), if a is mutable, return iterator, or const_iterator.
**************************************************
*****************************************************
**************************************************
Front Insert Sequence
Functions:
Front:
a.front()
Push_front:
a.push_front(p)
Pop_front:
a.pop_front(); return void!!
Page:144