template<class TYPE> class GSArray: public GArray<TYPE>

Sortable array.

Inheritance:


Public Methods

[more] GSArray()
Constructs an empty array.
[more] GSArray(int hibound)
Constructs an array with subscripts in range 0 to hibound.
[more] GSArray(int lobound, int hibound)
Constructs an array with subscripts in range lobound to hibound.
[more] GSArray(const GContainer<TYPE> &gc)
Constructs an array by copying the elements of container gc.
[more] GSArray(const GArray<TYPE> &gc)
Copy constructor.
[more]void sort()
Sort array elements.
[more]void sort(int lo, int hi)
Sort array elements in subscript range lo to hi.


Inherited from GArray:

Public Methods

oint lbound() const
oint hbound() const
oTYPE& operator[](int n)
oconst TYPE& operator[](int n) const
oTYPE& operator[](GPosition pos)
oconst TYPE& operator[](GPosition pos) const
o operator TYPE* ()
o operator const TYPE* () const
ovoid empty()
ovoid touch(int n)
ovoid resize(int hibound)
ovoid resize(int lobound, int hibound)
ovoid shift(int disp)
ovoid del(int n, unsigned int howmany=1)
ovoid ins(int n, const TYPE &val, unsigned int howmany=1)
oGArray<TYPE> & operator= (const GArray &ga)


Inherited from GContainer:

Public Methods

ovirtual const TYPE* get(const GPosition &pos) const
ovirtual TYPE* get(const GPosition &pos)


Inherited from GContainerBase:

Public Methods

ovirtual int size() const
ovirtual GPosition firstpos() const
ovirtual GPosition lastpos() const
ovirtual void nextpos(GPosition &pos) const
ovirtual void prevpos(GPosition &pos) const


Documentation

Sortable array. Template class GSArray<TYPE> implements sorting routines for the array elements. These sorting routines are implemented in a subclass in order to reduce the template instantiation overhead for class GArray. Besides the TYPE constructors and operators required by class GArray, this template class must be able to access a less-or-equal comparison operator: TYPE::operator<=(const TYPE&).
o GSArray()
Constructs an empty array. The valid subscript range is initially empty. Member function touch and resize provide convenient ways to enlarge the subscript range.

o GSArray(int hibound)
Constructs an array with subscripts in range 0 to hibound. The subscript range can be subsequently modified with member functions touch and resize.
Parameters:
hibound - upper bound of the initial subscript range.

o GSArray(int lobound, int hibound)
Constructs an array with subscripts in range lobound to hibound. The subscript range can be subsequently modified with member functions touch and resize.
Parameters:
lobound - lower bound of the initial subscript range.
hibound - upper bound of the initial subscript range.

o GSArray(const GContainer<TYPE> &gc)
Constructs an array by copying the elements of container gc. The valid subscript will range from zero to the number of elements in container gc minus one.
Parameters:
gc - container from which elements will be copied.

o GSArray(const GArray<TYPE> &gc)
Copy constructor. The resulting array will have the same valid subscript range as array gc. All elements in gc will be copied into the constructed array.

ovoid sort()
Sort array elements. Sort all array elements in ascending order. Array elements are compared using the less-or-equal comparison operator for type TYPE.

ovoid sort(int lo, int hi)
Sort array elements in subscript range lo to hi. Sort all array elements whose subscripts are in range lo..hi in ascending order. The other elements of the array are left untouched. An exception is thrown if arguments lo and hi are not in the valid subscript range. Array elements are compared using the less-or-equal comparison operator for type TYPE.
Parameters:
lo - low bound for the subscripts of the elements to sort.
hi - high bound for the subscripts of the elements to sort.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java