- Every container allocates and manages its own storage.
- Type definitions common to all containers:
C::value_typetype of values held in containerC::reference value_type&C::const_referenceC::iteratorC::const_iteratorC::reverse_iteratorC::const_reverse_iteratorC::difference_typedifference between iteratorsC::size_typesize of container
3. Member functions common to all containers:
C( )– default constructorC(c), C c2(c1)– copy constructor~C( )– destructorc.begin()– returns an iterator to first elementc.end()– returns an iterator after last elementc.rbegin()– returns a reverse iterator to last elem.c.rend()– returns a reverse iterator before first elem.c1 == c2– equality comparison for same type cont.c1 != c2– inequality comparison for same type cont.c.size()– returns number of elements. in cont.c.max_size()– returns size() of largest number of elements.c.empty() – returns true if cont. is emptyc1 < c2– lexicographic comparisonc1 > c2– samec1 <= c2– samec1 >= c2– samec1 = c2– assignment operationc1.swap(c2)– swaps two containers
4. Sequence containers
vector– simulates an expandable array, occupying contiguous memorylist– based on doubly linked listdeque– a double ended queue, which uses a directory managing blocks of contiguous memory
5. Member functions common to all sequence containers:
C(n,t)– constructs a sequence of n copies of tC(iter1,iter2)– constructs a sequence equal to the range [iter1,iter2)c.insert(iter,t)– inserts a copy of t before iter. Returns an iter to t.c.insert(iter,n,t)– inserts n copies of t before iter.c.insert(iter1,iter2,iter3)– inserts the sequence [iter2,iter3) before iter1c.erase(iter)– erases the element pointed to by iterc.erase(iter1,iter2)– erases elements in range [iter1,iter2)
