ULAPI  8.0
Public Member Functions | List of all members
ULVector< T > Class Template Reference

A resizable array, with constant-time access by index. Slots in the vector are pointers of type T* rather than objects of type T, so unused slots take up only the memory required to store a pointer. More...

#include <ulcontainers.h>

Public Member Functions

 ULVector ()
 
 ULVector (uluint32 newSize)
 
 ULVector (const ULVector< T > &v)
 
 ~ULVector ()
 
ULVector< T > & operator= (const ULVector< T > &v)
 
void clear ()
 
T & operator[] (uluint32 n)
 
uluint32 size () const
 
void resize (uluint32 newSize)
 
void append (const T &item)
 

Detailed Description

template<class T>
class ULVector< T >

A resizable array, with constant-time access by index. Slots in the vector are pointers of type T* rather than objects of type T, so unused slots take up only the memory required to store a pointer.

TODO: this container needs extension if it is to be used more generally. It's a bare-bones vector at the moment.

Constructor & Destructor Documentation

template<class T >
ULVector< T >::ULVector ( )

Default constructor. This sets the vector size to zero.

template<class T >
ULVector< T >::ULVector ( uluint32  newSize)

Constructor.

Parameters
[in]newSizeThe desired vector length.
template<class T>
ULVector< T >::ULVector ( const ULVector< T > &  v)

Copy constructor.

template<class T >
ULVector< T >::~ULVector ( )

Destructor.

Member Function Documentation

template<class T>
void ULVector< T >::append ( const T &  item)
template<class T >
void ULVector< T >::clear ( )

Frees all memory associated with this vector, and sets the vector size to zero.

template<class T>
ULVector< T > & ULVector< T >::operator= ( const ULVector< T > &  v)

Assignment operator. This operator deletes this vector's existing nodes, builds a complete new copy of the specified vector, and sets up this vector to contain the new copy.

template<class T >
T & ULVector< T >::operator[] ( uluint32  n)
Returns
a reference to the vector element at the specified index.
Parameters
[in]nThe index of the desired data.
template<class T >
void ULVector< T >::resize ( uluint32  newSize)

Changes the size of this vector to the specified size, and moves the data in the old vector to the new one. If the new size is smaller than the old, the excess items in the old vector are deleted.

Parameters
[in]newSizeThe desired vector size.
template<class T >
uluint32 ULVector< T >::size ( ) const
Returns
the size (i.e. the number of slots) in this vector.

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