VDKArray< T > Class Template Reference
provides a templatized array
More...
#include <vdkarray.h>
List of all members.
Public Member Functions
Private Member Functions
Detailed Description
template<class T>
class VDKArray< T >
provides a templatized array
- OVERVIEW
- VDKArray<T> class implements a value semantic, all managed objects are copied from original values. An array can contains type<T> objects, can resize himself to accomodate others objects, however resizing operations must be explicit. A generic type<T> must provide consistent:
- T() default constructor
- T(T& t) copy initializer
- =(T& t) assignement operator in order to assure correct array deep-copying
- Relational operators
- A generic type<T> should provide also:
- int operator==(T& t) equality operator
- int operator<(T& t) disequality operator in order to correctly use heapsort routine.
- CONSIDERATIONS
- Arrays are bounds checked, try to access an element out of bounds will cause an assert()-call failure and abnormal program termination. I recommend to use typedef to consistently declare a type<T> Array:
typedef Array<someClass> SomeClassArray;
- DEBUGGING
- NO_DEBUG directive will avoid any bound checking
- REFERENCE
- U. Breymann et al. "Composite templates and inheritance" C++ Report, Vol.7, nr. 2, pp. 33-39, 1995
Constructor & Destructor Documentation
Member Function Documentation
template<class T>
T& VDKArray< T >::At |
( |
int |
ndx |
) |
[inline, private] |
template<class T>
void VDKArray< T >::resize |
( |
int |
ns |
) |
[inline] |
template<class T>
T& VDKArray< T >::operator[] |
( |
int |
ndx |
) |
[inline] |
Access operator
- tip
- can be used in both left or rigth side of an expression
typedef<int> IntArray;
IntArray integers(10);
integers[0] = 6;
int i = integers[0];
Sorts array on place in n*log(n) time.
- Reference
- W.H.Press et al. "Numerical recipes in C" 2nd edition Cambridge University Press, 1992
The documentation for this class was generated from the following file: