containers::VectorSP< T, SizeT > Class Template Reference

A small-size pointer-focused vector. More...

#include <vectorsp.h>

List of all members.

Public Types

typedef T value_type
 Value type.
typedef T & reference
 Reference type.
typedef T const & const_reference
 Const reference type.
typedef T * pointer
 Pointer type.
typedef T const * const_pointer
 Const pointer type.
typedef SizeT size_type
 Size type.
typedef ptrdiff_t difference_type
 Difference type.
typedef pointer iterator
 Normal iterator type.
typedef const_pointer const_iterator
 Const iterator type.
typedef std::reverse_iterator<
iterator
reverse_iterator
 Reverse iterator.
typedef std::reverse_iterator<
const_iterator
const_reverse_iterator
 Const reverse iterator.

Public Member Functions

 VectorSP ()
 Constructor.
 VectorSP (VectorSP const &v)
 Copy constructor.
VectorSPoperator= (VectorSP const &right)
 Assignment operator.
 ~VectorSP ()
 Destructor.
void clear (bool free=false)
 Clears the vector.
void erase (iterator it, bool free=false)
 Erases an element of the vector.
void erase (iterator first, iterator last, bool free=false)
 Erases a range of elements of the vector.
iterator insert (iterator pos, value_type const &val)
 Inserts an element at a specified position.
void pop_back (bool free=false)
 Removes the last element.
void push_back (value_type const &val)
 Inserts an element at the end.
void reserve (size_type capacity)
 Sets the minimum capacity of the vector.
void resize (size_type size, value_type const &val=NULL, bool free=false)
 Resizes the vector.
iterator begin ()
 Returns an iterator to the first element of the vector.
iterator end ()
 Returns an iterator beyond the last element of the vector.
const_iterator begin () const
 Returns a const iterator to the first element of the vector.
const_iterator end () const
 Returns a const iterator beyond the last element of the vector.
reverse_iterator rbegin ()
 Returns a reverse iterator to the beginning of the vector.
reverse_iterator rend ()
 Returns a reverse iterator to the end of the vector.
const_reverse_iterator rbegin () const
 Returns a const reverse iterator to the beginning of the vector.
const_reverse_iterator rend () const
 Returns a const reverse iterator to the end of the vector.
reference operator[] (size_type idx)
 Operator to access an arbitrary element of the vector.
const_reference operator[] (size_type idx) const
 Operator to access an arbitrary element of the vector (const version).
reference front ()
 Returns the first element of the vector.
const_reference front () const
 Returns the first element of the vector (const version).
reference back ()
 Returns the last element of the vector.
const_reference back () const
 Returns the last element of the vector (const version).
const_pointer data () const
 Returns the data in the container.
size_type size () const
 Returns the actual number of elements in the vector.
bool empty () const
 Returns whether the vector is empty.
size_type capacity () const
 Returns the capacity of the vector.
size_type max_size () const
 Returns the maximum size of the vector.


Detailed Description

template<class T, class SizeT>
class containers::VectorSP< T, SizeT >

This class is a vector-like designed with small size, pointer values and efficiency in mind.

Parameters:
T The type of elements in the mini vector (must be a pointer).
SizeT An unsigned integer type used for the size, which determines how much elements can be inserted in the vector.


Member Function Documentation

template<class T, class SizeT>
void containers::VectorSP< T, SizeT >::clear ( bool  free = false  )  [inline]

Clears the vector.

Parameters:
[in] free true if operator delete should be called on non-NULL elements in the vector, false otherwise.

template<class T, class SizeT>
void containers::VectorSP< T, SizeT >::erase ( iterator  it,
bool  free = false 
) [inline]

Erases an element of the vector.

Parameters:
[in] it An iterator pointing to the element to erase.
[in] free true if operator delete should be called on the removed element (if non-NULL), false otherwise.

template<class T, class SizeT>
void containers::VectorSP< T, SizeT >::erase ( iterator  first,
iterator  last,
bool  free = false 
) [inline]

Erases a range of elements of the vector.

Parameters:
[in] first The first iterator of the range.
[in] last The last iterator of the range.
[in] free true if operator delete should be called on removed, non-NULL pointers, false otherwise.

template<class T, class SizeT>
VectorSP< T, SizeT >::iterator containers::VectorSP< T, SizeT >::insert ( iterator  pos,
value_type const &  val 
) [inline]

Inserts an element at a specified position.

Parameters:
[in] pos An iterator pointing to the element immediately after where the new element will be added.
[in] val The value of the new element.
Returns:
An iterator to the new element, or end() if no new element could be added.

template<class T, class SizeT>
void containers::VectorSP< T, SizeT >::reserve ( size_type  capacity  )  [inline]

Sets the minimum capacity of the vector. If the given capacity is inferior to the current one, this function is a no-op.

Parameters:
[in] capacity The new capacity of the vector. If this is superior to max_size(), it is truncated to max_size().

template<class T, class SizeT>
void containers::VectorSP< T, SizeT >::resize ( size_type  size,
value_type const &  val = NULL,
bool  free = false 
) [inline]

Resizes the vector. If the new size is inferior to the current one, then additional elements are removed, with the delete pointer possibly being called on non-NULL pointers in the vector (the capacity is left untouched though). Else, new elements are added at the end of the vector.

Parameters:
[in] size The new size of the vector. If this is superior to max_size(), it is truncated to max_size().
[in] val The value of the potential new elements.
[in] free true if operator delete should be called on removed, non-NULL pointers, false otherwise.


The documentation for this class was generated from the following file:
Generated on Wed Aug 15 00:37:22 2007 for Epona API by  doxygen 1.5.2