Template based implementation of singly and doubly linked lists. The involved types should have 'prev' or 'next' fields and the list header should have 'head' or 'tail' fields.
template append(header, node)
template prepend(header, node)
template unlink(header, node)