Main Page Modules Class Hierarchy Data Structures File List Data Fields Globals Related Pages

# Oscl_Vector< T, Alloc > Class Template Reference
[OSCL Base]

`#include <oscl_vector.h>`

Inheritance diagram for Oscl_Vector< T, Alloc >:

## Public Types
typedef T | value_type
typedef T * | pointer
typedef T & | reference
typedef const T & | const_reference
typedef T * | iterator
typedef const T * | const_iterator
## Public Methods
| Oscl_Vector ()
| Oscl_Vector (uint32 n)
| Oscl_Vector (const Oscl_Vector< T, Alloc > &x)
virtual | ~Oscl_Vector ()
Oscl_Vector< T, Alloc > & | operator= (const Oscl_Vector< T, Alloc > &x)
void | push_back (const T &x)
void | push_front (const T &x)
iterator | insert (iterator pos, const T &x)
T & | operator[] (uint32 n)
const T & | operator[] (uint32 n) const
T & | front ()
const T & | front () const
T & | back ()
const T & | back () const
void | pop_back ()
void | clear ()
void | destroy ()
iterator | begin () const
iterator | end () const
iterator | erase (iterator pos)
iterator | erase (iterator first, iterator last)

## Detailed Description

### template<class T, class Alloc>
class Oscl_Vector< T, Alloc >

Oscl_Vector Class. A subset of STL::Vector methods. Oscl_Vector supports random access to elements, constant time insertion and removal of elements at the end of the vector, and linear time insertion and removal of elements at the beginning or middle of the vector. The number of elements in a vector can vary dynamically, and memory management is performed automatically.

## Member Typedef Documentation

template<class T, class Alloc>
typedef const T* Oscl_Vector< T, Alloc >::const_iterator

template<class T, class Alloc>
typedef const T& Oscl_Vector< T, Alloc >::const_reference

template<class T, class Alloc>
typedef T* Oscl_Vector< T, Alloc >::iterator

template<class T, class Alloc>
typedef T* Oscl_Vector< T, Alloc >::pointer

template<class T, class Alloc>
typedef T& Oscl_Vector< T, Alloc >::reference

template<class T, class Alloc>
typedef T Oscl_Vector< T, Alloc >::value_type

## Constructor & Destructor Documentation

template<class T, class Alloc>
Oscl_Vector< T, Alloc >::Oscl_Vector | ( |  | ) | `[inline]`

| Creates an empty vector.

template<class T, class Alloc>
Oscl_Vector< T, Alloc >::Oscl_Vector | ( | uint32 | n | ) | `[inline]`

  | Creates an empty vector with capacity n. Parameters:
  n | creates a vector with n elements. The main reason for specifying n is efficiency. If you know the capacity to which your vector must grow, then it is more efficient to allocate the vector all at once rather than rely on the automatic reallocation scheme. This also helps cotrol the invalidation of iterators.

template<class T, class Alloc>
Oscl_Vector< T, Alloc >::Oscl_Vector | ( | const Oscl_Vector< T, Alloc > & | x | ) | `[inline]`

  | Copy Constructor. Parameters:
  x | vector class to copy.

template<class T, class Alloc>
virtual Oscl_Vector< T, Alloc >::~Oscl_Vector | ( |  | ) | `[inline, virtual]`

| The destructor.

## Member Function Documentation

template<class T, class Alloc>
const T& Oscl_Vector< T, Alloc >::back | ( |  | ) | const`[inline]`

| Returns the last element.

template<class T, class Alloc>
T& Oscl_Vector< T, Alloc >::back | ( |  | ) | `[inline]`

| Returns the last element.

template<class T, class Alloc>
iterator Oscl_Vector< T, Alloc >::begin | ( |  | ) | const`[inline]`

| Returns an iterator pointing to the beginning of the vector. Reimplemented from Oscl_Vector_Base.

template<class T, class Alloc>
void Oscl_Vector< T, Alloc >::clear | ( |  | ) | `[inline]`

| Removes all elements.

template<class T, class Alloc>
void Oscl_Vector< T, Alloc >::destroy | ( |  | ) | `[inline]`

| Destroy -- this is like an explicit destructor call. Reimplemented from Oscl_Vector_Base.

template<class T, class Alloc>
iterator Oscl_Vector< T, Alloc >::end | ( |  | ) | const`[inline]`

| Returns an iterator pointing to the end of the vector.. Reimplemented from Oscl_Vector_Base.

template<class T, class Alloc>
iterator Oscl_Vector< T, Alloc >::erase | ( | iterator | first,
|  | iterator | last
| ) | `[inline]`

  | Erases elements in range [first, last). Erasing an element invalidates all iterators pointing to elements following the deletion point. Parameters:
  first | starting position
  last | ending position, this position is not erased

template<class T, class Alloc>
iterator Oscl_Vector< T, Alloc >::erase | ( | iterator | pos | ) | `[inline]`

  | Erases the element pointed to by iterator pos. Erasing an element invalidates all iterators pointing to elements following the deletion point. Parameters:
  pos | iterator at erase position

template<class T, class Alloc>
const T& Oscl_Vector< T, Alloc >::front | ( |  | ) | const`[inline]`

| Returns the first element.

template<class T, class Alloc>
T& Oscl_Vector< T, Alloc >::front | ( |  | ) | `[inline]`

| Returns the first element.

template<class T, class Alloc>
iterator Oscl_Vector< T, Alloc >::insert | ( | iterator | pos,
|  | const T & | x
| ) | `[inline]`

  | Inserts a new element before the one at pos. Parameters:
  pos | position at which to insert the new element.
  x | new element

template<class T, class Alloc>
Oscl_Vector<T, Alloc>& Oscl_Vector< T, Alloc >::operator= | ( | const Oscl_Vector< T, Alloc > & | x | ) | `[inline]`

| The assignment operator

template<class T, class Alloc>
const T& Oscl_Vector< T, Alloc >::operator[] | ( | uint32 | n | ) | const`[inline]`

  | Returns the n'th element. Parameters:
  n | element position to return

template<class T, class Alloc>
T& Oscl_Vector< T, Alloc >::operator[] | ( | uint32 | n | ) | `[inline]`

  | Returns the n'th element. Parameters:
  n | element position to return

template<class T, class Alloc>
void Oscl_Vector< T, Alloc >::pop_back | ( |  | ) | `[inline]`

| Removes the last element. Reimplemented from Oscl_Vector_Base.

template<class T, class Alloc>
void Oscl_Vector< T, Alloc >::push_back | ( | const T & | x | ) | `[inline]`

  | Inserts a new element at the end. Inserting an element invalidates all iterators if memory reallocation occurs as a result of the insertion. Parameters:
  x | new element

template<class T, class Alloc>
void Oscl_Vector< T, Alloc >::push_front | ( | const T & | x | ) | `[inline]`

  | Inserts a new element at the front. Inserting an element invalidates all iterators if memory reallocation occurs as a result of the insertion. Parameters:
  x | new element

The documentation for this class was generated from the following file:

- oscl_vector.h