Page Speed Optimization Libraries
1.13.35.1
|
#include "inline_slist.h"
Inherits net_instaweb::InlineSList< T >::IterBase.
Public Member Functions | |
Iterator & | operator++ () |
T * | Get () |
T * | operator-> () |
T & | operator* () |
bool | operator== (const Iterator &other) const |
bool | operator!= (const Iterator &other) const |
Friends | |
class | InlineSList< T > |
default copy op, dtor are OK. | |
Iterator interface to the list contents. You may use this both for simple enumeration and for deletion. Iteration works the same as with any STL container.
If you want to remove things, make sure not to call the operator ++ when you do, as after deletion the iterator will be pointing at the next element already (or past the end!). An example of doing it right:
InlineSList<Type>::iterator iter(list.begin()); while (iter != list.end()) { if (ShouldErase(*iter)) { list.Erase(&iter); } else { ++iter; } }
This type does not make general guarantees of iterators staying valid on operations — only the iterator passed to Erase() will be fixed, not any others; and Append operations should not be done concurrent with iteration.