Logo Search packages:      
Sourcecode: djvulibre version File versions

GTArray< TYPE > Class Template Reference

#include <GContainer.h>

Inheritance diagram for GTArray< TYPE >:

GArrayTemplate< TYPE >

List of all members.


Detailed Description

template<class TYPE>
class GTArray< TYPE >

Dynamic array for simple types. Template class GTArray<TYPE># implements an array of elements of {simple} type TYPE#. {Simple} means that objects of type TYPE# can be created, copied, moved or destroyed without using specific constructors or destructor functions. Class GTArray<TYPE># will move or copy objects using simple bitwise copies. Otherwise you must use class GArray<TYPE>#. This class only implement constructors. See class {GArrayTemplate} for a description of all access methods.

Definition at line 626 of file GContainer.h.


Public Member Functions

void del (int n, int howmany=1)
void empty ()
 GTArray (int lo, int hi)
 GTArray (int hi)
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 * ()
 operator const TYPE * () const
 operator TYPE * ()
GTArrayoperator= (const GTArray &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
GPBufferBase gdata
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