Using collections

Dynamic arrays introduce a basic protocol common to most collections. Some protocol is applicable only to sequences (deques, sorted sequences, and arrays). In particular, protocol related to random access of array elements to either insert or remove elements only makes sense for sequences which maintain elements in some sort of order. The distinction between serial and random access to collection elements is a key concept. All collections can be processed serially by iterating over collection elements. Only sequences permit random access or access based on collection order.

Details of this important distinction between serial and random access to array elements are illustrated by example programs in this and in subsequent sections. The common collection protocols include functions for creating collections, retrieving collection elements, iterating over collections, querying collection state (size, occurrences of an element), removing collection elements, and destroying collections. You will also see examples illustrating memory management responsibilities for clients of collection classes.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker