Public Types | Public Member Functions | Protected Member Functions | Private Types | List of all members
lar::sparse_vector< T >::iterator Class Reference

Iterator to the sparse vector values. More...

#include <sparse_vector.h>

Inheritance diagram for lar::sparse_vector< T >::iterator:
lar::sparse_vector< T >::const_iterator

Public Types

typedef const_iterator::reference reference
 
typedef const_iterator::const_reference const_reference
 
typedef const_iterator::special special
 
- Public Types inherited from lar::sparse_vector< T >::const_iterator
typedef std::forward_iterator_tag iterator_category
 
typedef container_t::value_type value_type
 
typedef container_t::difference_type difference_type
 
typedef container_t::pointer pointer
 
typedef container_t::reference reference
 
typedef vector_t::const_reference const_reference
 

Public Member Functions

 iterator ()
 Default constructor, does not iterate anywhere. More...
 
 iterator (container_t &c, size_type offset=0)
 Constructor from a container and an offset. More...
 
 iterator (const container_t &c, const typename special::begin _)
 Special constructor: initializes at the beginning of the container. More...
 
 iterator (const container_t &c, const typename special::end _)
 Special constructor: initializes at the end of the container. More...
 
reference operator[] (size_type offset) const
 Random access. More...
 
reference operator* () const
 Dereferenciation operator (can't write non-empty elements!) More...
 
iteratoroperator++ ()
 Increment and decrement operators. More...
 
iterator operator++ (int _)
 
iteratoroperator+= (difference_type delta)
 Increment and decrement operators. More...
 
iteratoroperator-= (difference_type delta)
 
iterator operator+ (difference_type delta) const
 
iterator operator- (difference_type delta) const
 
- Public Member Functions inherited from lar::sparse_vector< T >::const_iterator
 const_iterator ()
 Default constructor, does not iterate anywhere. More...
 
 const_iterator (const container_t &c, size_type offset)
 Constructor from a container and a offset. More...
 
 const_iterator (const container_t &c, const typename special::begin)
 Special constructor: initializes at the beginning of the container. More...
 
 const_iterator (const container_t &c, const typename special::end)
 Special constructor: initializes at the end of the container. More...
 
const_reference operator[] (size_type offset) const
 Random access. More...
 
const_reference operator* () const
 Constant dereferenciation operator. More...
 
difference_type operator- (const const_iterator &iter) const
 Distance operator. More...
 
range_const_iterator get_current_range () const
 Returns the current range internal value; use it at your own risk!! More...
 
const_iteratoroperator++ ()
 Increment and decrement operators. More...
 
const_iterator operator++ (int)
 
const_iteratoroperator+= (difference_type delta)
 Increment and decrement operators. More...
 
const_iteratoroperator-= (difference_type delta)
 
const_iterator operator+ (difference_type delta) const
 
const_iterator operator- (difference_type delta) const
 
bool operator== (const const_iterator &as) const
 Iterator comparisons. More...
 
bool operator!= (const const_iterator &as) const
 
bool operator< (const const_iterator &than) const
 
bool operator> (const const_iterator &than) const
 
bool operator<= (const const_iterator &than) const
 
bool operator>= (const const_iterator &than) const
 

Protected Member Functions

 iterator (const_iterator from)
 
- Protected Member Functions inherited from lar::sparse_vector< T >::const_iterator
void refresh_state ()
 Reassigns the internal state according to the index. More...
 

Private Types

typedef const_iterator::container_t container_t
 

Additional Inherited Members

- Protected Types inherited from lar::sparse_vector< T >::const_iterator
typedef sparse_vector< T > container_t
 
typedef container_t::size_type size_type
 
typedef container_t::range_list_t::const_iterator ranges_const_iterator
 
- Protected Attributes inherited from lar::sparse_vector< T >::const_iterator
const container_tcont
 pointer to the container More...
 
size_type index
 pointer to the current value, as absolute index More...
 
ranges_const_iterator currentRange
 pointer to the current (or next) range More...
 

Detailed Description

template<typename T>
class lar::sparse_vector< T >::iterator

Iterator to the sparse vector values.

This iterator respects the traits of an immutable forward iterator, EXCEPT that the iterator can be non-dereferenciable even when it's a "past the end" iterator. That is due to the fact that currently dereferencing (and assigning) to a cell which is not in a range already is not supported yet (it can be done with some complicate mechanism).

Definition at line 1580 of file sparse_vector.h.

Member Typedef Documentation

template<typename T>
typedef const_iterator::const_reference lar::sparse_vector< T >::iterator::const_reference

Definition at line 1586 of file sparse_vector.h.

template<typename T>
typedef const_iterator::container_t lar::sparse_vector< T >::iterator::container_t
private

Definition at line 1581 of file sparse_vector.h.

template<typename T>
typedef const_iterator::reference lar::sparse_vector< T >::iterator::reference

Definition at line 1585 of file sparse_vector.h.

template<typename T>
typedef const_iterator::special lar::sparse_vector< T >::iterator::special

Definition at line 1587 of file sparse_vector.h.

Constructor & Destructor Documentation

template<typename T>
lar::sparse_vector< T >::iterator::iterator ( )
inline

Default constructor, does not iterate anywhere.

Definition at line 1590 of file sparse_vector.h.

1590 : const_iterator() {}
const_iterator()
Default constructor, does not iterate anywhere.
template<typename T>
lar::sparse_vector< T >::iterator::iterator ( container_t c,
size_type  offset = 0 
)
inline

Constructor from a container and an offset.

Definition at line 1593 of file sparse_vector.h.

1593  :
1594  const_iterator(c, offset) {}
const_iterator()
Default constructor, does not iterate anywhere.
template<typename T>
lar::sparse_vector< T >::iterator::iterator ( const container_t c,
const typename special::begin  _ 
)
inline

Special constructor: initializes at the beginning of the container.

Definition at line 1597 of file sparse_vector.h.

1597  :
1598  const_iterator(c, _) {}
const_iterator()
Default constructor, does not iterate anywhere.
template<typename T>
lar::sparse_vector< T >::iterator::iterator ( const container_t c,
const typename special::end  _ 
)
inline

Special constructor: initializes at the end of the container.

Definition at line 1601 of file sparse_vector.h.

1601  :
1602  const_iterator(c, _) {}
const_iterator()
Default constructor, does not iterate anywhere.
template<typename T>
lar::sparse_vector< T >::iterator::iterator ( const_iterator  from)
inlineprotected

Definition at line 1638 of file sparse_vector.h.

1638 : const_iterator(from) {}
const_iterator()
Default constructor, does not iterate anywhere.

Member Function Documentation

template<typename T>
reference lar::sparse_vector< T >::iterator::operator* ( ) const
inline

Dereferenciation operator (can't write non-empty elements!)

Definition at line 1628 of file sparse_vector.h.

1629  { return reference(const_iterator::operator*()); }
const_iterator::reference reference
template<typename T>
iterator lar::sparse_vector< T >::iterator::operator+ ( difference_type  delta) const
inline

Definition at line 1620 of file sparse_vector.h.

1621  { return const_iterator::operator+(delta); }
const_iterator operator+(difference_type delta) const
template<typename T>
iterator& lar::sparse_vector< T >::iterator::operator++ ( )
inline

Increment and decrement operators.

Definition at line 1610 of file sparse_vector.h.

1610 { const_iterator::operator++(); return *this; }
const_iterator & operator++()
Increment and decrement operators.
template<typename T>
iterator lar::sparse_vector< T >::iterator::operator++ ( int  _)
inline

Definition at line 1611 of file sparse_vector.h.

1611 { return const_iterator::operator++(_); }
const_iterator & operator++()
Increment and decrement operators.
template<typename T>
iterator& lar::sparse_vector< T >::iterator::operator+= ( difference_type  delta)
inline

Increment and decrement operators.

Definition at line 1616 of file sparse_vector.h.

1617  { const_iterator::operator+=(delta); return *this; }
const_iterator & operator+=(difference_type delta)
Increment and decrement operators.
template<typename T>
iterator lar::sparse_vector< T >::iterator::operator- ( difference_type  delta) const
inline

Definition at line 1622 of file sparse_vector.h.

1623  { return const_iterator::operator-(delta); }
const_iterator operator-(difference_type delta) const
template<typename T>
iterator& lar::sparse_vector< T >::iterator::operator-= ( difference_type  delta)
inline

Definition at line 1618 of file sparse_vector.h.

1619  { const_iterator::operator+=(delta); return *this; }
const_iterator & operator+=(difference_type delta)
Increment and decrement operators.
template<typename T>
reference lar::sparse_vector< T >::iterator::operator[] ( size_type  offset) const
inline

Random access.

Definition at line 1605 of file sparse_vector.h.

1606  { return (*const_iterator::cont)[const_iterator::index + offset]; }
const container_t * cont
pointer to the container
size_type index
pointer to the current value, as absolute index

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