Displaying 1 result from an estimated 1 matches for "ensurehead".
2015 Oct 08
5
ilist/iplist are broken (maybe I'll fix them?)
...exposes UB), and provides a few extra features that I don't think
are really worth paying for.
The default configuration effectively does the following:
template <class T> ListNode { T *prev, T *next; };
template <class T> struct List {
T *Head = nullptr;
void ensureHead() {
if (!Head) {
Head = new T();
Head->next = nullptr;
Head->prev = Head;
}
}
// complex insertion/removal logic.
};
Every list operation (even begin()/end()) starts by somehow calling
`ensureHead()`.
The key structural differenc...