Page Speed Optimization Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | List of all members
net_instaweb::InlineSList< T > Class Template Reference

#include "inline_slist.h"


class  ConstIterator
class  Iterator

Public Types

typedef Iterator iterator
typedef ConstIterator const_iterator

Public Member Functions

 ~InlineSList ()
 The destructor deletes all the nodes in the list. More...
bool IsEmpty () const
void Append (T *node)
void Erase (Iterator *iter)
T * Last ()
 Returns last item.
const T * Last () const
iterator begin ()
 Iterator interface. More...
const_iterator begin () const
iterator end ()
 End iterators have their position at NULL.
const_iterator end () const

Detailed Description

template<class T>
class net_instaweb::InlineSList< T >

This forward declaration is necessary! Ignore IWYU when it tells you to remove it. Sadly, the pragma is being ignored right now.

A simple linked list that's optimized for memory usage, cheap appends and traversals (including removals). Links are stored within elements rather than externally.

To permit that, the type T must provide next() and set_next() methods, accessible to InlineSList<T>. Easy way to do that is by inheriting off InlineSListElement<T>.

Note that while this results in a list object that's just one pointer wide, iterators are two pointers wide.

Representation: circular linked list with a pointer to tail. Iterators store pointers to nodes before the one they're conceptually targeting.

Constructor & Destructor Documentation

template<class T >
net_instaweb::InlineSList< T >::~InlineSList ( )

The destructor deletes all the nodes in the list.

< start at head node.

stop when we deleted tail.

Member Function Documentation

template<class T>
iterator net_instaweb::InlineSList< T >::begin ( )

Iterator interface.

Note that all of these pass tail_ since iterator implementation internally keeps track of the /previous/ node to the one pointed at.

template<class T >
void net_instaweb::InlineSList< T >::Erase ( Iterator iter)

Removes the item pointed to by the iterator, and updates the iterator to point after it. Note that this means that it is now effectively advanced (potentially past the end of the list) and that you should not call ++ if you just want to consume one item. See the iterator docs for example of proper use.

Only 1 element before the call, 0 now.

Removed tail.. need to point it earlier.

Iterator is now one-past-end

The documentation for this class was generated from the following file: