Public Types | Public Member Functions | Public Attributes
ash::two_d_iterator< Container > Struct Template Reference

2D iterator used by sparse_table. More...

#include <ash/sparse_table.h>

List of all members.

Public Types

typedef two_d_iterator iterator
typedef Container::iterator row_iterator
typedef Container::value_type _tmp_vt
 Apparently some versions of VC++ have trouble with two ::'s in a typename.
typedef _tmp_vt::nonempty_iterator col_iterator
Iterator Traits
typedef
std::bidirectional_iterator_tag 
iterator_category
typedef _tmp_vt::value_type value_type
typedef _tmp_vt::difference_type difference_type
typedef _tmp_vt::reference reference
typedef _tmp_vt::pointer pointer

Public Member Functions

void advance_past_end ()
Constructors/Destructors

We use the default copy constructor.

We use the default destructor.

 two_d_iterator ()
 Default constructor.
 two_d_iterator (row_iterator begin, row_iterator end, row_iterator curr)
 "Real" constructor.
 two_d_iterator (row_iterator begin, row_iterator end, row_iterator curr, col_iterator col)
 Constructor for starting at an arbitrary column.
Dereference Operators
reference operator* () const
pointer operator-> () const
Arithmetic Operators
iteratoroperator++ ()
 Pre-increment.
iterator operator++ (int)
 Post-increment.
iteratoroperator-- ()
 Pre-decrement.
iterator operator-- (int)
 Post-decrement.
Comparison Operators

We only define ==, != is defined in std::rel_ops.

bool operator== (const iterator &itr) const
 Equality operator.

Public Attributes

row_iterator row_begin
row_iterator row_end
row_iterator row_current
col_iterator col_current

Detailed Description

template<class Container>
struct ash::two_d_iterator< Container >

2D iterator used by sparse_table.

Template Parameters:
ContainerThe container type we iterate through.

This is a 2D iterator. You specify a begin and end over a list of containers. We iterate over each container by iterating over it. It's actually simple:

 VECTOR.begin() VECTOR[0].begin()  --------> VECTOR[0].end() ---,
     |          ________________________________________________/
     |          \_> VECTOR[1].begin()  -------->  VECTOR[1].end() -,
     |          ___________________________________________________/
     v          \_> ......
 VECTOR.end()

It's impossible to do random access on one of these things in constant time, so it's just a bidirectional iterator.

Unfortunately, because we need to use this for a non-empty iterator, we use nonempty_begin() and nonempty_end() instead of begin() and end() (though only going across, not down).


Member Typedef Documentation

template<class Container >
typedef Container::value_type ash::two_d_iterator< Container >::_tmp_vt

Apparently some versions of VC++ have trouble with two ::'s in a typename.


Constructor & Destructor Documentation

template<class Container >
ash::two_d_iterator< Container >::two_d_iterator ( ) [inline]

Default constructor.

template<class Container >
ash::two_d_iterator< Container >::two_d_iterator ( row_iterator  begin,
row_iterator  end,
row_iterator  curr 
) [inline]

"Real" constructor.

Parameters:
beginThe beginning of the range of rows.
endThe end of the range of rows.
currThe current row.
Note:
We always iterate over each row completely.
template<class Container >
ash::two_d_iterator< Container >::two_d_iterator ( row_iterator  begin,
row_iterator  end,
row_iterator  curr,
col_iterator  col 
) [inline]

Constructor for starting at an arbitrary column.

Parameters:
beginThe beginning of the range of rows.
endThe end of the range of rows.
currThe current row.
colThe current column.
Note:
Identical to "real" constructor except for column specification.

Member Function Documentation

template<class Container >
iterator& ash::two_d_iterator< Container >::operator++ ( ) [inline]

Pre-increment.

template<class Container >
iterator ash::two_d_iterator< Container >::operator++ ( int  ) [inline]

Post-increment.

template<class Container >
iterator& ash::two_d_iterator< Container >::operator-- ( ) [inline]

Pre-decrement.

template<class Container >
iterator ash::two_d_iterator< Container >::operator-- ( int  ) [inline]

Post-decrement.

template<class Container >
bool ash::two_d_iterator< Container >::operator== ( const iterator itr) const [inline]

Equality operator.


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