3 ms·
I assume he meant "a list from which an element can be removed in constant time."
by tg3 14y ago
I assume he meant "a list from which an element can be removed in constant time."
- mpyne 14y agoPerhaps I'm being dumb, but doesn't std::list<T> already do exactly this? From SGI's STL docs: "A list is a doubly linked list. That is, it is a Sequence that supports both forward and backward traversal, and (amortized) constant time insertion and removal of elements at the beginning or the end, or in the middle"
- malkia 14y agoAs others have said - yes, as long as you keep the iterator not the object itself. e.g. from T itself you cannot find where it was stored, so with std::list<something>, and then only from something you can't find where it is (you can have to look for it in the list).