Page Speed Optimization Libraries  1.2.24.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Public Types | Public Member Functions
net_instaweb::InlineSList< T > Class Template Reference

#include "inline_slist.h"

List of all members.

Classes

class  ConstIterator
class  Iterator
class  IterBase

Public Types

typedef Iterator iterator
typedef ConstIterator const_iterator

Public Member Functions

 ~InlineSList ()
 The destructor deletes all the nodes in the list.
bool IsEmpty () const
void Append (T *node)
void Erase (Iterator *iter)
T * Last ()
 Returns last item.
const T * Last () const
iterator begin ()
 Iterator interface.
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 >

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 ( ) [inline]

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 ( ) [inline]

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) [inline]

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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines