Go to the previous, next section.

Association Lists

An association list element contains both a key and a data pointer. The data associated with a particular key can be retrieved with a simple lookup method. The key and data fields are both void* pointers. Association lists are implemented by the alist and alist_e classes in the files `alist.h' and `alist.cc'. These classes are derived from the generic list classes (see section Generic Lists) and behave similarly.

The amtflist class has the same interface as the alist class and provides the same functionality. The only difference is that it is based on the move-to-front list class. See section Move-to-front Lists. You may want to use this if you expect your application to access list elements with a high degree of locality.

Like all of the other SUIF lists, the association lists have iterators to make it easy for you to traverse them. The alist_iter class uses the same interface as the generic list iterator and works for both alist and amtflist objects.

Go to the previous, next section.