Hacker News new | past | comments | ask | show | jobs | submit login

Perhaps 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"




As 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).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: