Problem Overview
----------------------------------------------------------------------------
In the DynamicArrays example in
%EPOCROOT%\Epoc32Ex\Base\ArraysAndLists\DynamicArrays there is an example of
using CArrayPtrFlat to hold a list of CBase objects. My problem is that I
need to go through the list and check to see if a certain object is already
in the list. It looks like this functionality has already been provided for
by the Find() method inherited from CArrayFix. (Otherwise I assume I would
just loop through the list pulling out each object and comparing it external
to the CArrayPtrFlat list. I assume this can be done with == ?).

The problem is the Find() method has the following signature and definition.
Everything makes sense to me except the first two arguments. Does anyone
know of example code that would help me here? Why all the talk about T-type
objects, when the example is using CArrayPtrFlat to store C-type objects?

----------------------------------------------------------------------------
----------------------------------------------------------------------------
The definition of Find() in the SDK
----------------------------------------------------------------------------

TInt Find(const T& aRef,TKeyArrayFix& aKey,TInt& anIndex) const;

Description
Finds the position of an element within the array, based on the matching of
keys, using a sequential search.

The array is searched sequentially for an element whose key matches the key
of the supplied <class T> object. The search starts with the first element
in the array.

Notes:

a.. Where an array has elements with duplicate keys, the function only
supplies the position of the first element in the array with that key.

Parameters
const T& aPtr A reference to an object of type<class T> whose
key is used for comparison.

TKeyArrayFix& aKey A reference to a key object defining the
properties of the key.

TInt& anIndex If the element is found, the reference is set to
the position of that element within the array. The position is relative to
zero, (i.e. the first element in the array is at position 0). If the element
is not found and the array is not empty, then the value of the reference is
set to the number of elements in the array. If the element is not found and
the array is empty, then the reference is set to zero.

Return value
TInt Zero, if the element with the specified key is found.
Non-zero, if the element with the specified key is not found.

----------------------------------------------------------------------------
----------------------------------------------------------------------------
A snipt of the example code:
----------------------------------------------------------------------------

CArrayPtrFlat<CElement>* ptrflat;
CElement* ptr;

// Construct an array of four CElement objects each
// containing the text "First" "second" etc
// Uses the AppendL() function to add the members
// and the [] operator to access elements.
ptrflat = new (ELeave) CArrayPtrFlat<CElement>(16);

ptr = new (ELeave) CElement;
_LIT(KMsgFirstElement,"First Element"
ptr->SetTextL(KMsgFirstElement);
ptrflat->AppendL(ptr);

ptr = new (ELeave) CElement;
_LIT(KMsgSecondElement,"Second Element"
ptr->SetTextL(KMsgSecondElement);
ptrflat->AppendL(ptr);

ptr = new (ELeave) CElement;
_LIT(KMsgThirdElement,"Third Element"
ptr->SetTextL(KMsgThirdElement);
ptrflat->AppendL(ptr);

/*
*How do I extend the example to search for a particular object instance in
the dynamic array?
*Say I have another handle to the second element named findMePtr.
*/

----------------------------------------------------------------------------
----------------------------------------------------------------------------
THANKS:
----------------------------------------------------------------------------
Thanks for your time and effort in answering this post.

Sincerely,
James Carpenter
Email: nawkboy@yahoo.com
AOL IM: nawkboyrules