// --------------------------------------------------------------------------- // Copyright (C) 1994 Borland International // array.cpp // Must link with myclass.cpp. // --------------------------------------------------------------------------- #include #include #include #include "../myclass.h" typedef TArrayAsVector ContainerType; typedef TArrayAsVectorIterator IteratorType; const int MaxItems=6; void ForEachCallBack(MyClass& mc, void* s) { cout << (char*)s << mc << endl; } void AddItems(ContainerType& container, int numItems) { for( int i=numItems; i>0; i-- ) { char buf[80]; ostrstream str( buf, sizeof(buf) ); str << i << " hello" << ends; container.Add(MyClass(buf)); } } void UseForwardIterator(ContainerType& container) { IteratorType iterator(container); while( iterator ) { cout << iterator.Current() << endl; iterator++; } } void UseIndex(ContainerType& container) { for( int i=container.LowerBound(); i