iterator_range Class Template Reference

#include <rangelib/iterator_range.hpp>

Inheritance diagram for iterator_range:

iterable_range_tag notional_range_tag

List of all members.


Detailed Description

template<typename I, typename T = iterator_range_traits<I, is_const_type<I>::value>>
class rangelib::iterator_range< I, T >

This class adapts an iterator pair into a Range.

Parameters:
I The iterator type
T The iterator range traits, used to deduce the Range's iterator, const_iterator, reference, const_reference and value_type
It is categoried as an Iterable Range

It could be used as follows

template<typename I>
void dump_elements(I from, I to)
{
  for(iterator_range<I> r(from, to); r; ++r)
  {
    std::cout << &r; // Dump the current value to stdout
  }
}

Notional Range methods

bool is_open () const
 Indicates whether the range is open.
reference current ()
 Returns the current value in the range.
const_reference current () const
 Returns the current value in the range.
 operator boolean_type () const
 Indicates whether the range is open.
reference operator* ()
 Returns the current value in the range.
const_reference operator* () const
 Returns the current value in the range.
class_typeadvance ()
 Advances the current position in the range.
class_typeoperator++ ()
 Advances the current position in the range.
class_type operator++ (int)
 Advances the current position in the range, returning a copy of the range prior to its being advanced.

Public Types

Member Types
typedef I iterator_type
 The iterator type.
typedef T traits_type
 The traits type.
typedef iterable_range_tag range_tag_type
 The range tag type.
typedef iterator_range< I, T > class_type
 The current instantiation of this type.
typedef traits_type::value_type value_type
 The value type.
typedef traits_type::iterator iterator
 The mutating (non-const) iterator type.
typedef traits_type::const_iterator const_iterator
 The non-mutating (const) iterator type.
typedef traits_type::reference reference
 The mutating (non-const) refernce type.
typedef
traits_type::const_reference 
const_reference
 The non-mutating (const) reference type.

Public Member Functions

Construction
template<typename I2>
 iterator_range (I2 first, I2 last)
 Constructs from an iterator pair.
template<typename T2, size_t N>
 iterator_range (T2(&ar)[N])
 Constructs from an array.
Iterable Range methods
iterator begin ()
 Returns an iterator to the current position of the range.
iterator end ()
 Returns an iterator to the end of the range.
const_iterator begin () const
 Returns an iterator to the current position of the range.
const_iterator end () const
 Returns an iterator to the end of the range.

Member Typedef Documentation

typedef I iterator_type

The iterator type.

typedef T traits_type

The traits type.

The range tag type.

typedef iterator_range<I, T> class_type

The current instantiation of this type.

typedef traits_type::value_type value_type

The value type.

typedef traits_type::iterator iterator

The mutating (non-const) iterator type.

typedef traits_type::const_iterator const_iterator

The non-mutating (const) iterator type.

typedef traits_type::reference reference

The mutating (non-const) refernce type.

typedef traits_type::const_reference const_reference

The non-mutating (const) reference type.


Constructor & Destructor Documentation

iterator_range ( I2  first,
I2  last 
) [inline]

Constructs from an iterator pair.

iterator_range ( T2(&)  ar[N]  )  [inline]

Constructs from an array.


Member Function Documentation

bool is_open (  )  const [inline]

Indicates whether the range is open.

reference current (  )  [inline]

Returns the current value in the range.

References STLSOFT_ASSERT.

const_reference current (  )  const [inline]

Returns the current value in the range.

References STLSOFT_ASSERT.

operator boolean_type (  )  const [inline]

Indicates whether the range is open.

reference operator* (  )  [inline]

Returns the current value in the range.

const_reference operator* (  )  const [inline]

Returns the current value in the range.

class_type& advance (  )  [inline]

Advances the current position in the range.

References STLSOFT_MESSAGE_ASSERT.

class_type& operator++ (  )  [inline]

Advances the current position in the range.

class_type operator++ ( int   )  [inline]

Advances the current position in the range, returning a copy of the range prior to its being advanced.

iterator begin (  )  [inline]

Returns an iterator to the current position of the range.

iterator end (  )  [inline]

Returns an iterator to the end of the range.

const_iterator begin (  )  const [inline]

Returns an iterator to the current position of the range.

const_iterator end (  )  const [inline]

Returns an iterator to the end of the range.


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

Generated on Thu Jun 10 08:58:33 2010 for STLSoft by  doxygen 1.5.6