Go to the previous, next section.

Move-to-front Lists

The move-to-front list class mtflist is just a minor variation of the glist class. See section Generic Lists. The user must provide a function that compares a list element with some other unspecified object. The mtflist class then provides a lookup method that uses the comparison function to search for a particular element. After every successful lookup, the returned element is moved to the front of the list. This works well for applications with good locality. The DECLARE_MTFLIST_CLASS macro works just like the DECLARE_LIST_CLASS macro, but it generates move-to-front list classes. The code for the mtflist class is in the files `mtflist.h' and `mtflist.cc'.

Go to the previous, next section.