Location:
e32std.h
Link against:
template <class T>
class TArray
Supported from 5.0
Generic array.
This class defines a generic array which can be constructed by any of the templated concrete arrays.
An instance of this class can be constructed by any of the templated array classes:
CArrayFixFlat<class T>
CArrayFixSeg<class T>
CArrayVarFlat<class T>
CArrayVarSeg<class T>
CArrayPakFlat<class T>
RArray<class T>
(not in ER5)
RPointerArray<class T>
(not in ER5)
and also the template specialisation classes:
RArray<TInt>
(not in ER5)
RArray<TUint>
(not in ER5)
It allows a degree of polymorphism amongst the array classes. It
permits the operator[]
and the Count()
member
functions of an array to be invoked without knowing which array class has been
used to construct that array.
TArray
allows access to elements of an array but does
not permit changes to those elements.
Use the Array()
member function of an array to
construct and return a TArray<class T>
object for that
array.
A TArray<class T>
type object is not intended to
be constructed explicitly by user code.
Note that in ER5, this class was defined in e32base.h
|
Defined in TArray
:
Count()
, TArray()
, operator[]
TArray(TInt (*aCount)(const CBase *aPtr),const TAny* (*anAt)(const CBase* aPtr,TInt anIndex),const CBase* aPtr));
The constructor for a TArray
object.
A TArray
object is not intended to be
instantiated explicitly. An object of this type is instantiated as a result of
a call to to the Array()
member function of a concrete array
class, specifically:
CArrayFixFlat<class T>::Array()
CArrayFixSeg<class T>::Array()
CArrayVarFlat<class T>::Array()
CArrayVarSeg<class T>::Array()
CArrayPakFlat<class T>::Array()
RArray<class T>::Array()
RPointerArray<class T>::Array()
RArray<TInt>::Array()
RArray<TUint>::Array()
|
TInt Count() const;
Returns the number of elements currently held in the array for which this generic array has been constructed.
|
const T& operator[](TInt anIndex) const;
Returns a reference to the element located at the specified position.
The returned reference is const
and cannot be
used to change the element. Any member function of the referenced template
class T
must be declared as const
if that
function is to be accessed through this operator.
|
|