Public Types | Public Member Functions | Public Attributes | Related Functions
ash::const_table_iterator< Table > Struct Template Reference

Const iterator type used by sparse_group & sparse_table. More...

#include <ash/impl/sparse_group.h>

List of all members.

Public Types

typedef table_iterator< Table > iterator
typedef const_table_iterator const_iterator
Iterator Traits
typedef
std::random_access_iterator_tag 
iterator_category
typedef Table::value_type value_type
typedef Table::difference_type difference_type
typedef Table::size_type size_type
typedef Table::const_reference reference
typedef Table::const_pointer pointer

Public Member Functions

void check () const
reference operator[] (difference_type n) const
 Element Access.
Constructors/Destructors

We use the default copy constructor.

We use the default destructor.

 const_table_iterator ()
 Default constructor.
 const_table_iterator (Table const *tbl, size_type p)
 "Real" constructor.
 const_table_iterator (iterator const &itr)
 Conversion constructor from an iterator.
Dereference Operators

The main thing our iterator does is dereference.

If the table entry we point to is empty, we return the default value type.

reference operator* () const
pointer operator-> () const
Arithmetic Operators
const_iteratoroperator+= (size_type t)
 Assignment addition (position).
const_iteratoroperator-= (size_type t)
 Assignment subtraction (position).
const_iteratoroperator++ ()
 Pre-increment.
const_iterator operator++ (int)
 Post-increment.
const_iteratoroperator-- ()
 Pre-decrement.
const_iterator operator-- (int)
 Post-decrement.
const_iterator operator+ (difference_type i) const
 Addition (position).
const_iterator operator- (difference_type i) const
 Subtraction (position).
difference_type operator- (const_iterator it) const
 Subtraction (distance).
Comparison Operators

Here we define the all of the comparisons, std::rel_ops won't convert an iterator.

bool operator== (const_iterator const &itr) const
 Equality operator.
bool operator!= (const_iterator const &itr) const
 Inequality operator.
bool operator< (const_iterator const &itr) const
 Less-than operator.
bool operator> (const_iterator const &itr) const
 Greater-than operator.
bool operator<= (const_iterator const &itr) const
 Less-or-equal operator.
bool operator>= (const_iterator const &itr) const
 Greator-or-equal operator.

Public Attributes

const Table * table
size_type pos

Related Functions

(Note that these are not member functions.)

template<class T >
const_table_iterator< T > operator+ (typename const_table_iterator< T >::difference_type i, const_table_iterator< T > it)
 Global addition operator.

Detailed Description

template<class Table>
struct ash::const_table_iterator< Table >

Const iterator type used by sparse_group & sparse_table.

Iterator type used by sparse_group & sparse_table.

Template Parameters:
TableThe type of table we iterate through.

Our iterator as simple as iterators can be: basically it's just the index into our table. Dereference, the only complicated thing, we punt to the table class. This just goes to show how much machinery STL requires to do even the most trivial tasks.By templatizing over Table, we have one iterator type which we can use for both sparse_tables and sparse_groups. In fact it works on any class that allows size() and operator[] (eg vector), as long as it does the standard STL typedefs too (eg value_type).


Constructor & Destructor Documentation

template<class Table >
ash::const_table_iterator< Table >::const_table_iterator ( ) [inline]

Default constructor.

template<class Table >
ash::const_table_iterator< Table >::const_table_iterator ( Table const *  tbl,
size_type  p 
) [inline]

"Real" constructor.

Parameters:
tblA pointer to the container.
pThe current position.
template<class Table >
ash::const_table_iterator< Table >::const_table_iterator ( iterator const &  itr) [inline]

Conversion constructor from an iterator.

Parameters:
itrThe iterator to convert.

Member Function Documentation

template<class Table >
bool ash::const_table_iterator< Table >::operator!= ( const_iterator const &  itr) const [inline]

Inequality operator.

template<class Table >
const_iterator ash::const_table_iterator< Table >::operator+ ( difference_type  i) const [inline]

Addition (position).

template<class Table >
const_iterator& ash::const_table_iterator< Table >::operator++ ( ) [inline]

Pre-increment.

template<class Table >
const_iterator ash::const_table_iterator< Table >::operator++ ( int  ) [inline]

Post-increment.

template<class Table >
const_iterator& ash::const_table_iterator< Table >::operator+= ( size_type  t) [inline]

Assignment addition (position).

template<class Table >
const_iterator ash::const_table_iterator< Table >::operator- ( difference_type  i) const [inline]

Subtraction (position).

template<class Table >
difference_type ash::const_table_iterator< Table >::operator- ( const_iterator  it) const [inline]

Subtraction (distance).

template<class Table >
const_iterator& ash::const_table_iterator< Table >::operator-- ( ) [inline]

Pre-decrement.

template<class Table >
const_iterator ash::const_table_iterator< Table >::operator-- ( int  ) [inline]

Post-decrement.

template<class Table >
const_iterator& ash::const_table_iterator< Table >::operator-= ( size_type  t) [inline]

Assignment subtraction (position).

template<class Table >
bool ash::const_table_iterator< Table >::operator< ( const_iterator const &  itr) const [inline]

Less-than operator.

template<class Table >
bool ash::const_table_iterator< Table >::operator<= ( const_iterator const &  itr) const [inline]

Less-or-equal operator.

template<class Table >
bool ash::const_table_iterator< Table >::operator== ( const_iterator const &  itr) const [inline]

Equality operator.

template<class Table >
bool ash::const_table_iterator< Table >::operator> ( const_iterator const &  itr) const [inline]

Greater-than operator.

template<class Table >
bool ash::const_table_iterator< Table >::operator>= ( const_iterator const &  itr) const [inline]

Greator-or-equal operator.

template<class Table >
reference ash::const_table_iterator< Table >::operator[] ( difference_type  n) const [inline]

Element Access.

Parameters:
nThe position of the element relative to the iterator.

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


© 2012   AshTL
Licensed under  AGPLv3
Hosted by  Get AshTL at SourceForge.net. Fast, secure and Free Open Source software downloads
Generated by  doxygen 1.7.4