stdx::ptr_vector< T > Class Template Reference

#include <ptr_vector.h>

List of all members.

Public Member Functions

 ptr_vector ()
 ptr_vector (iterator first, iterator last)
template<typename StlPtrInputIterator>
 ptr_vector (StlPtrInputIterator first, StlPtrInputIterator last)
 ~ptr_vector ()
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
reverse_iterator rbegin ()
const_reverse_iterator rbegin () const
reverse_iterator rend ()
const_reverse_iterator rend () const
size_type size () const
size_type max_size () const
bool empty () const
size_type capacity () const
void reserve (size_type n)
reference operator[] (size_type n)
const_reference operator[] (size_type n) const
reference at (size_type n)
const_reference at (size_type n) const
reference front ()
const_reference front () const
reference back ()
const_reference back () const
void push_back (pointer x)
pointer pop_back ()
iterator insert (iterator position, pointer x)
void insert (iterator position, iterator first, iterator last)
template<typename StlPtrInputIterator>
void insert (iterator position, StlPtrInputIterator first, StlPtrInputIterator last)
pointer detach (iterator position)
template<typename StlPtrOutputIterator>
void detach (iterator first, iterator last, StlPtrOutputIterator result)
void swap (ptr_vector &other)
void swap (std::vector< T * > &other)
void sort ()
template<typename Compare>
void sort (Compare comp)


Detailed Description

template<typename T>
class stdx::ptr_vector< T >

ptr_vector

stdx::ptr_vector<T> is a wrapper for std::vector<T*> that cuts one level of indirection for iterators and member functions. In essence ptr_vector lets you treat a vector of pointers as if it were a vector of values.

See also:
http://www.codeproject.com/vcpp/stl/ptr_vecto.asp
for a detailed description


Constructor & Destructor Documentation

template<typename T>
stdx::ptr_vector< T >::ptr_vector (  )  [inline]

constructs an empty ptr_vector

template<typename T>
stdx::ptr_vector< T >::ptr_vector ( iterator  first,
iterator  last 
) [inline]

constructs a ptr_vector from a pair of ptr_vector<T>::iterators in the range [first, last), e.g.

 ptr_vector one;
 one.push_back (new T);
 ptr_vector two (one.begin(), one.end());
 

template<typename T>
template<typename StlPtrInputIterator>
stdx::ptr_vector< T >::ptr_vector ( StlPtrInputIterator  first,
StlPtrInputIterator  last 
) [inline]

constructs a ptr_vector from a pair of input iterators with value_type T* in the range [first, last), e.g.

 std::list<T*> lst;
 lst.push_back (new T);
 ptr_vector ptv (lst.begin(), lst.end());
 

template<typename T>
stdx::ptr_vector< T >::~ptr_vector (  )  [inline]

destroys pointers in ptr_vector; pointed-to objets are NOT destroyed!!


Member Function Documentation

template<typename T>
iterator stdx::ptr_vector< T >::begin (  )  [inline]

Returns:
iterator to the first element in the ptr_vector

template<typename T>
const_iterator stdx::ptr_vector< T >::begin (  )  const [inline]

Returns:
const_iterator to the first element in the ptr_vector

template<typename T>
iterator stdx::ptr_vector< T >::end (  )  [inline]

Returns:
iterator indicating one past the end

template<typename T>
const_iterator stdx::ptr_vector< T >::end (  )  const [inline]

Returns:
const_iterator indicating one past the end

template<typename T>
reverse_iterator stdx::ptr_vector< T >::rbegin (  )  [inline]

Returns:
reverse_iterator (end())

template<typename T>
const_reverse_iterator stdx::ptr_vector< T >::rbegin (  )  const [inline]

Returns:
const_reverse_iterator (end())

template<typename T>
reverse_iterator stdx::ptr_vector< T >::rend (  )  [inline]

Returns:
reverse_iterator (begin())

template<typename T>
const_reverse_iterator stdx::ptr_vector< T >::rend (  )  const [inline]

Returns:
const_reverse_iterator (begin())

template<typename T>
size_type stdx::ptr_vector< T >::size (  )  const [inline]

Returns:
current number of elements

template<typename T>
size_type stdx::ptr_vector< T >::max_size (  )  const [inline]

Returns:
maximal number of elements the ptr_vector can hold

template<typename T>
bool stdx::ptr_vector< T >::empty (  )  const [inline]

Returns:
is the ptr_vector empty

template<typename T>
size_type stdx::ptr_vector< T >::capacity (  )  const [inline]

Returns:
number of elements that the ptr_vector can hold without requiring reallocation;
Note: reallocation neither copies pointed-to objects nor invalidates ptr_vector iterators!

template<typename T>
void stdx::ptr_vector< T >::reserve ( size_type  n  )  [inline]

ensures that capacity() is greater or equal to n

template<typename T>
reference stdx::ptr_vector< T >::operator[] ( size_type  n  )  [inline]

Returns:
reference to element n

template<typename T>
const_reference stdx::ptr_vector< T >::operator[] ( size_type  n  )  const [inline]

Returns:
const reference to element n

template<typename T>
reference stdx::ptr_vector< T >::at ( size_type  n  )  [inline]

Returns:
reference to element at position n

template<typename T>
const_reference stdx::ptr_vector< T >::at ( size_type  n  )  const [inline]

Returns:
reference to element at position n

template<typename T>
reference stdx::ptr_vector< T >::front (  )  [inline]

Returns:
reference to the first element

template<typename T>
const_reference stdx::ptr_vector< T >::front (  )  const [inline]

Returns:
const reference to the first element

template<typename T>
reference stdx::ptr_vector< T >::back (  )  [inline]

Returns:
reference to the last element

template<typename T>
const_reference stdx::ptr_vector< T >::back (  )  const [inline]

Returns:
const reference to the last element

template<typename T>
void stdx::ptr_vector< T >::push_back ( pointer  x  )  [inline]

appends element x to the ptr_vector; x must not be 0 or NULL

template<typename T>
pointer stdx::ptr_vector< T >::pop_back (  )  [inline]

removes the last element from the ptr_vector;

Returns:
pointer to the removed element

template<typename T>
iterator stdx::ptr_vector< T >::insert ( iterator  position,
pointer  x 
) [inline]

inserts element x before position; x must not be 0 or NULL;

Returns:
iterator to the inserted element x

template<typename T>
void stdx::ptr_vector< T >::insert ( iterator  position,
iterator  first,
iterator  last 
) [inline]

inserts a sequence delimited by [first, last) before position;

template<typename T>
template<typename StlPtrInputIterator>
void stdx::ptr_vector< T >::insert ( iterator  position,
StlPtrInputIterator  first,
StlPtrInputIterator  last 
) [inline]

inserts a sequence delimited by input iterators with value_type T* in the range [first, last) before position;

template<typename T>
pointer stdx::ptr_vector< T >::detach ( iterator  position  )  [inline]

removes element denoted by position;

Returns:
pointer to removed element

template<typename T>
template<typename StlPtrOutputIterator>
void stdx::ptr_vector< T >::detach ( iterator  first,
iterator  last,
StlPtrOutputIterator  result 
) [inline]

copies elements in the range [first, last) into the range [result, result + (last - first)) starting from first and proceeding to last; result must point to the begin of a range large enough to hold the copied elements; removes copied elements from ptr_vector

See also:
std::copy

template<typename T>
void stdx::ptr_vector< T >::swap ( ptr_vector< T > &  other  )  [inline]

exchanges elements with other ptr_vector

template<typename T>
void stdx::ptr_vector< T >::swap ( std::vector< T * > &  other  )  [inline]

exchanges elements with std::vector<T*>

template<typename T>
void stdx::ptr_vector< T >::sort (  )  [inline]

sorts ptr_vector according to operator<

template<typename T>
template<typename Compare>
void stdx::ptr_vector< T >::sort ( Compare  comp  )  [inline]

sorts ptr_vector according to Compare function (object) comp


The documentation for this class was generated from the following file:
Generated on Wed Jan 17 14:53:52 2007 for iTunesIslands by  doxygen 1.5.1-p1