Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

GArray< TYPE > Class Template Reference

#include <GContainer.h>

Inheritance diagram for GArray< TYPE >:

GArrayTemplate< TYPE >

List of all members.

Detailed Description

template<class TYPE>
class GArray< TYPE >

Dynamic array for general types. Template class GArray<TYPE># implements an array of elements of type TYPE#. This template class must be able to access the following functions. {itemize} a default constructor TYPE::TYPE()#, a copy constructor TYPE::TYPE(const TYPE &)#, and optionally a destructor TYPE::~TYPE()#. {itemize} This class only implement constructors. See class {GArrayTemplate} for a description of all access methods.

Definition at line 645 of file GContainer.h.

Public Member Functions

void del (int n, int howmany=1)
void empty ()
 GArray (int lo, int hi)
 GArray (int hi)
 GArray ()
int hbound () const
void ins (int n, const TYPE &val, int howmany=1)
void ins (int n, int howmany=1)
int lbound () const
 operator const TYPE * () const
 operator TYPE * ()
GArrayoperator= (const GArray &r)
void resize (int lobound, int hibound)
void resize (int hibound)
void shift (int disp)
int size () const
void sort ()
void steal (GArrayTemplate &ga)
void touch (int n)
Dynamic Arrays
These class implement arrays of objects of any type. Each element is identified by an integer subscript. The valid subscripts range is defined by dynamically adjustable lower- and upper-bounds. Besides accessing and setting elements, member functions are provided to insert or delete elements at specified positions.

Class {GArrayTemplate} implements all methods for manipulating arrays of type TYPE#. You should not however create instances of this class. You should instead use one of the following classes: {itemize} Class {GArray<TYPE>} is the most general class, Class {GTArray<TYPE>} is more efficient, but only works for types that do not require sophisticated constructors or destructors, such as the plain old C types (e.g. int# or char# ...). Class {GPArray<TYPE>} implements an array of smart-pointers {GP<TYPE>} to objects of type TYPE#. Using this class reduces the size of the code generated by the template instanciation. {itemize}

Another variant of dynamic arrays is implemented in file {Arrays.h}. The main difference is that class {TArray}, {DArray} and {DPArray} implement a copy-on-demand scheme.

Dynamic arrays.

const TYPE & operator[] (int n) const
TYPE & operator[] (int const n)
void sort (int lo, int hi)

Protected Member Functions

void ins (int n, const void *src, int howmany=1)
void steal (GArrayBase &ga)

Protected Attributes

void * data
int hibound
int lobound
int maxhi
int minlo
const Traits & traits

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

Generated by  Doxygen 1.6.0   Back to index