News for hackers. Stuff that matters.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by tptacek on Thursday August 30, 2012 @01:21PM (#4455678)
What do you mean, "O(1) list"?
Re:Why should I have written ZeroMQ in C, not C++ (part II) by tg3 on Thursday August 30, 2012 @01:55PM (#4455841)
I assume he meant "a list from which an element can be removed in constant time."
Re:Why should I have written ZeroMQ in C, not C++ (part II) by mpyne on Thursday August 30, 2012 @03:15PM (#4456255)
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"

Re:Why should I have written ZeroMQ in C, not C++ (part II) by malkia on Thursday August 30, 2012 @04:10PM (#4456494)
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).