Const iterator type used by sparse_group & sparse_table. More...
#include <ash/impl/sparse_group.h>
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_iterator & | operator+= (size_type t) |
Assignment addition (position). | |
const_iterator & | operator-= (size_type t) |
Assignment subtraction (position). | |
const_iterator & | operator++ () |
Pre-increment. | |
const_iterator | operator++ (int) |
Post-increment. | |
const_iterator & | operator-- () |
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. |
Const iterator type used by sparse_group & sparse_table.
Iterator type used by sparse_group & sparse_table.
Table | The 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).
ash::const_table_iterator< Table >::const_table_iterator | ( | ) | [inline] |
Default constructor.
ash::const_table_iterator< Table >::const_table_iterator | ( | Table const * | tbl, |
size_type | p | ||
) | [inline] |
"Real" constructor.
tbl | A pointer to the container. |
p | The current position. |
ash::const_table_iterator< Table >::const_table_iterator | ( | iterator const & | itr | ) | [inline] |
Conversion constructor from an iterator.
itr | The iterator to convert. |
bool ash::const_table_iterator< Table >::operator!= | ( | const_iterator const & | itr | ) | const [inline] |
Inequality operator.
const_iterator ash::const_table_iterator< Table >::operator+ | ( | difference_type | i | ) | const [inline] |
Addition (position).
const_iterator& ash::const_table_iterator< Table >::operator++ | ( | ) | [inline] |
Pre-increment.
const_iterator ash::const_table_iterator< Table >::operator++ | ( | int | ) | [inline] |
Post-increment.
const_iterator& ash::const_table_iterator< Table >::operator+= | ( | size_type | t | ) | [inline] |
Assignment addition (position).
const_iterator ash::const_table_iterator< Table >::operator- | ( | difference_type | i | ) | const [inline] |
Subtraction (position).
difference_type ash::const_table_iterator< Table >::operator- | ( | const_iterator | it | ) | const [inline] |
Subtraction (distance).
const_iterator& ash::const_table_iterator< Table >::operator-- | ( | ) | [inline] |
Pre-decrement.
const_iterator ash::const_table_iterator< Table >::operator-- | ( | int | ) | [inline] |
Post-decrement.
const_iterator& ash::const_table_iterator< Table >::operator-= | ( | size_type | t | ) | [inline] |
Assignment subtraction (position).
bool ash::const_table_iterator< Table >::operator< | ( | const_iterator const & | itr | ) | const [inline] |
Less-than operator.
bool ash::const_table_iterator< Table >::operator<= | ( | const_iterator const & | itr | ) | const [inline] |
Less-or-equal operator.
bool ash::const_table_iterator< Table >::operator== | ( | const_iterator const & | itr | ) | const [inline] |
Equality operator.
bool ash::const_table_iterator< Table >::operator> | ( | const_iterator const & | itr | ) | const [inline] |
Greater-than operator.
bool ash::const_table_iterator< Table >::operator>= | ( | const_iterator const & | itr | ) | const [inline] |
Greator-or-equal operator.
reference ash::const_table_iterator< Table >::operator[] | ( | difference_type | n | ) | const [inline] |
Element Access.
n | The position of the element relative to the iterator. |
© 2012 | Licensed under | Hosted by | Generated by 1.7.4 |