May 10, 2005 Re: feedback wanted: DLlist.d - doubly linked list implementation in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | "Ben Hinkle" <ben.hinkle@gmail.com> wrote in news:d5q8fi$1090$1@digitaldaemon.com: > The downside of intrusive lists is that an item can be in only one list. > There is an interesting article about intrusive data structures in C++ on http://www.codefarms.com/publications/intrusiv/intr.htm They use a third template parameter which is only used to be able to inherit multiple times from the intrusive base. The purpose is to maintain the node in multiple data structures. Example: template<class Node,class Edge,int i=0> class Node { // ... }; class Town : public Node<Town,Flight,0> , public Node<Town,Flight,1> { // ... }; IMHO this is one of the rare contexts were multiple inheritance has an advantage. I was wondering if the same behaviour could be achieved with mixins. |
Copyright © 1999-2021 by the D Language Foundation