• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kviewshell

ArrayBaseT< TYPE > Class Template Reference

Dynamic array template base class. More...

#include <Arrays.h>

Inheritance diagram for ArrayBaseT< TYPE >:

Inheritance graph
[legend]

List of all members.


Public Member Functions

void ins (int n, const TYPE &val, unsigned int howmany=1)
 operator const TYPE * ()
 operator const TYPE * () const
 operator TYPE * ()
const TYPE & operator[] (int n) const
TYPE & operator[] (int n)
void sort (int lo, int hi)
void sort ()
virtual ~ArrayBaseT (void)

Protected Member Functions

 ArrayBaseT (void)

Detailed Description

template<class TYPE>
class ArrayBaseT< TYPE >

Dynamic array template base class.

This is an auxiliary template base class for {DArray} and {TArray} implementing some shared functions which {depend} on the type of the array elements (this is contrary to {ArrayBase}). It's not supposed to be constructed by hands. Use {DArray} and {TArray} instead.

Definition at line 449 of file Arrays.h.


Constructor & Destructor Documentation

template<class TYPE>
virtual ArrayBaseT< TYPE >::~ArrayBaseT ( void   )  [inline, virtual]

Definition at line 452 of file Arrays.h.

template<class TYPE>
ArrayBaseT< TYPE >::ArrayBaseT ( void   )  [inline, protected]

Definition at line 510 of file Arrays.h.


Member Function Documentation

template<class TYPE>
void ArrayBaseT< TYPE >::ins ( int  n,
const TYPE &  val,
unsigned int  howmany = 1 
)

Insert new elements into an array.

This function inserts howmany# elements at position n# into the array. The initial value val# is copied into the new elements. All array elements previously located at subscripts n# and higher are moved to subscripts n+howmany# and higher. The upper bound of the valid subscript range is increased in order to account for this shift.

Parameters:
n subscript of the first inserted element.
val initial value of the new elements.
howmany number of elements to insert.

template<class TYPE>
ArrayBaseT< TYPE >::operator const TYPE * (  ) 

template<class TYPE>
ArrayBaseT< TYPE >::operator const TYPE * (  )  const

Returns a pointer for reading (but not modifying) the array elements.

This pointer can be used to access the array elements with the same subscripts and the usual bracket syntax. This pointer remains valid as long as the valid subscript range is unchanged. If you change the subscript range, you must stop using the pointers returned by prior invocation of this conversion operator.

template<class TYPE>
ArrayBaseT< TYPE >::operator TYPE * (  ) 

Returns a pointer for reading or writing the array elements.

This pointer can be used to access the array elements with the same subscripts and the usual bracket syntax. This pointer remains valid as long as the valid subscript range is unchanged. If you change the subscript range, you must stop using the pointers returned by prior invocation of this conversion operator.

template<class TYPE>
const TYPE& ArrayBaseT< TYPE >::operator[] ( int  n  )  const

Returns a constant reference to the array element for subscript n#.

This reference can only be used for reading (as "#a[n]#") an array element. This operation will not extend the valid subscript range: an exception {GException} is thrown if argument n# is not in the valid subscript range. This variant of operator[]# is necessary when dealing with a const DArray<TYPE>#.

Reimplemented in DPArray< TYPE >.

template<class TYPE>
TYPE& ArrayBaseT< TYPE >::operator[] ( int  n  ) 

Returns a reference to the array element for subscript n#.

This reference can be used for both reading (as "#a[n]#") and writing (as "#a[n]=v#") an array element. This operation will not extend the valid subscript range: an exception {GException} is thrown if argument n# is not in the valid subscript range.

Reimplemented in DPArray< TYPE >.

template<class TYPE>
void ArrayBaseT< TYPE >::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.

template<class TYPE>
void ArrayBaseT< TYPE >::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#.


The documentation for this class was generated from the following file:
  • Arrays.h

kviewshell

Skip menu "kviewshell"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kviewshell
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal