A std::vector<T> composite. More...
#include <Collection.h>
Public Types | |
typedef T | value_type |
typedef A | allocator_type |
typedef A::size_type | size_type |
typedef A::difference_type | difference_type |
typedef std::vector< T, A > ::iterator | iterator |
typedef std::vector< T, A > ::const_iterator | const_iterator |
typedef std::vector< T, A > ::reverse_iterator | reverse_iterator |
typedef std::vector< T, A > ::const_reverse_iterator | const_reverse_iterator |
typedef std::vector< T, A > ::pointer | pointer |
typedef std::vector< T, A > ::const_pointer | const_pointer |
typedef std::vector< T, A > ::reference | reference |
typedef std::vector< T, A > ::const_reference | const_reference |
Public Member Functions | |
Collection (const Collection &rhs) | |
Collection (const std::vector< T, A > &rhs) | |
Collection (size_type n, const T &value=T()) | |
template<class In > | |
Collection (In begin, In end) | |
virtual Collection & | operator= (const Collection &rhs) |
template<class In > | |
void | assign (In begin, In end) |
virtual void | assign (size_type n, const T &value) |
virtual void | push_back (const T &value) |
virtual void | pop_back (void) |
virtual iterator | insert (iterator pos, const T &value) |
virtual void | insert (iterator pos, size_type n, const T &value) |
template<class In > | |
void | insert (iterator pos, In begin, In end) |
virtual iterator | erase (iterator pos) |
virtual iterator | erase (iterator begin, iterator end) |
virtual void | clear () |
virtual iterator | begin () |
virtual reverse_iterator | rbegin () |
virtual iterator | end () |
virtual reverse_iterator | rend () |
virtual const_iterator | begin () const |
virtual const_iterator | end () const |
virtual value_type & | operator[] (size_type pos) |
virtual value_type & | at (size_type pos) |
virtual const value_type & | operator[] (size_type pos) const |
virtual const value_type & | at (size_type pos) const |
virtual size_type | size (void) const |
virtual size_type | max_size () const |
virtual bool | empty () const |
virtual void | resize (size_type sz, const T &value=T()) |
virtual size_type | capacity () const |
virtual void | reserve (size_type n) |
virtual void | swap (Collection &rhs) |
virtual allocator_type | get_allocator () const |
Protected Attributes | |
std::vector< T, A > | c_ |
Friends | |
template<typename U , typename V > | |
bool | operator== (const Collection< U, V > &lhs, const Collection< U, V > &rhs) |
template<class U , class V > | |
bool | operator< (const Collection< U, V > &lhs, const Collection< U, V > &rhs) |
template<class U , class V > | |
void | swap (Collection< U, V > &lhs, Collection< U, V > &rhs) |
A std::vector<T> composite.
The STL std::vector<T> does not have a virtual destructor, hence it is not possible for vector-like classes to derive in order to inherit the std::vector<T> interface.
Collection<T> has a std::vector<T> member variable c_ and implements a complete forwarding interface for this member. It can be used as a safe base class if the vector interface is common in a framework.
See the std::vector<T> documentation for all details.