For some applications, especially those where it is necessary to
traverse lists in both directions, doubly-linked lists work much better
than singly-linked lists. The dlist
class provides doubly-linked
lists with the same interface as the generic lists. See section Generic Lists. Thus you can interchange these data structures without having
to rewrite your code. The dlist_e
elements are derived from the
generic list element class but they also include the backwards link
fields. The dlist_iter
iterator works like the standard
glist_iter
iterator, and the DECLARE_DLIST_CLASS
macro is
the same as the DECLARE_LIST_CLASS
macro except that it produces
doubly-linked lists. All of these things are implemented in the
`dlist.h' and `dlist.cc' files.