// Template method that works for BaseArray, BlockArray, PointerArray or BaseList template <class ARRAY, typename T> void GenericSample(ARRAY& test, const T& aValue, const T& bValue) { const Int ARRAY_TEST_SIZE = 1024; Int i; // append ARRAY_TEST_SIZE elements (all initialized by the default constructor) for (i = 0; i < ARRAY_TEST_SIZE; i++) test.Append(); // use an AutoIterator to iterate over the whole array and assign aValue to every element for (AutoIterator<ARRAY> it(test); it; ++it) *it = aValue; // insert an element with bValue at index 10 test.Insert(10, bValue); // erase the element at index 11 test.Erase(11); // just a quick check: we should still have the same number of elements if (test.GetCount() != ARRAY_TEST_SIZE) GeBoom(); // using an Iterator: assign bValue to all elements from test[25] to test[49] typename ARRAY::Iterator end = test.Begin() + 50; for (typename ARRAY::Iterator it = test.Begin() + 25; it != end; it++) *it = bValue; }