by codr7 · 1y ago · 0 comments
Multiple inheritance, possible but you'd have to jump some hoops to disambiguate since you're dealing with multiple copies of the same base class.
class<T> IntrusiveListNode { T* next, T* prev }
class SomeObj {
IntrusiveListNode<SomeObj> list_foo;
IntrusiveListNode<SomeObj> list_bar;
}Thanks for the update, my C++ is pretty rusty.
But it brings up another problem for me; when iterating a list like that, how do you know which of the links to follow? I get that you can do it manually step by step, but if you wanted to say write an iterator. Member pointers?