Modernized GAlib  3.0.0 current
Public Member Functions | Protected Attributes | List of all members
GAArray< T > Class Template Reference

Array Base Class. More...

#include <GAArray.h>

Inheritance diagram for GAArray< T >:
[legend]

Public Member Functions

 GAArray (unsigned int s)
 
 GAArray (const GAArray< T > &orig)
 
GAArray< T > & operator= (const GAArray< T > &orig)
 
GAArray< T > * clone ()
 
const T & operator[] (unsigned int i) const
 
T & operator[] (unsigned int i)
 
void copy (const GAArray< T > &orig)
 
void copy (const GAArray< T > &orig, unsigned int dest, unsigned int src, unsigned int length)
 
void move (unsigned int dest, unsigned int src, unsigned int length)
 
void swap (unsigned int i, unsigned int j)
 
int size () const
 
int size (unsigned int n)
 
bool equal (const GAArray< T > &b, unsigned int dest, unsigned int src, unsigned int length) const
 
template<class U >
bool operator== (const GAArray< U > &rhs) const
 
template<class U >
bool operator!= (const GAArray< U > &rhs) const
 

Protected Attributes

std::vector< T > a
 the contents of the array
 

Detailed Description

template<class T>
class GAArray< T >

Array Base Class.

This class can be used only on objects that have:

In other words, use only primitive objects in this array (e.g. int, float, pointers, etc) The constructor will try to initialize to zero, but only if the type is right. We don't do any over-allocation, so resizing can be expensive. No error checking on the copy, so don't walk over end of array!

Todo:
should do specialization for simple types that does memcpy rather than loop
Template Parameters
T

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