Dynamic array.
Dynamic array. Template class GArray<TYPE> implements an array of elements of type 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.This template class must be able to access
- a null constructor TYPE::TYPE(),
- a copy constructor TYPE::TYPE(const TYPE &),
- and a copy operator TYPE & operator=(const TYPE &).
GArray(int hibound)
GArray(int lobound, int hibound)
hibound - upper bound of the initial subscript range. GArray(const GContainer<TYPE> &gc)
GArray(const GArray<TYPE> &gc)
int lbound() const
int hbound() const
TYPE& operator[](int n)
const TYPE& operator[](int n) const
TYPE& operator[](GPosition pos)
const TYPE& operator[](GPosition pos) const
operator TYPE* ()
operator const TYPE* () const
void empty()
void touch(int n)
int lineno=1;
GArray<GString> a;
while (! end_of_file()) {
a.touch[lineno];
a[lineno++] = read_a_line();
}
void resize(int hibound)
void resize(int lobound, int hibound)
hibound - upper bound of the new subscript range. void shift(int disp)
void del(int n, unsigned int howmany=1)
howmany - number of elements to delete. void ins(int n, const TYPE &val, unsigned int howmany=1)
val - initial value of the new elements.
howmany - number of elements to insert. GArray<TYPE> & operator= (const GArray &ga)
Alphabetic index HTML hierarchy of classes or Java