There's an overload of erase that returns an iterator pointer?
Name:
Anonymous2009-01-18 9:48
>>5
Oh wow. Both overloads return iterator pointers of the next element. In which case, I present a challenger:
l.clear();
Name:
Anonymous2009-01-18 9:52
>>5 The erase() function either deletes the element at location loc, or deletes the elements between start and end (including start but not including end). The return value is the element after the last element erased.
Name:
Anonymous2009-01-18 10:02
If I'd have to store pointers in a list, I'd rather store smart pointers, or derive a list class like this: class TList : public list<T*>
{
public:
iterator erase(iterator loc)
{
delete *loc;
return list<T*>::erase(loc);
}
};
Also make your owns versions of clear, remove, erase with boundaries etc.
Name:
Anonymous2009-01-18 10:08
One word, garbage collection, thread over.
Name:
Anonymous2009-01-18 10:22
One word, smart pointers, thread resumed.
Name:
Anonymous2009-01-18 10:25
One word, cyclic references, thread over.
Name:
Anonymous2009-01-18 10:46
One word. C++ IS FOR FAGS. NO EXCEPTIONS THREAD OVER
Name:
Anonymous2009-01-18 11:51
One word, bump.
Also, smart pointers over garbage collection anytime.
>>18
I know, and I've raged at it more than once.
But I still kinda like it though, especially those wonderful containers, priority_queue fit this one problem in my gameserver perfectly.