STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ... ATLSTL - Template Software for the Active Template Library COMSTL - The Standard Template Library meets the Component Object Model .netSTL - Standard Template Library meets the Microsoft.NET Common Language Runtime InetSTL - The Standard Template Library meets WinInet MFCSTL - Template Software for the Microsoft Foundation Classes UNIXSTL - Template Software for the UNIX Operating System WinSTL - where the Standard Template Library meets the Win32 API

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

iterator_range Class Template Reference
[Range Adaptors]

This class adapts an iterator pair into a Range. More...

#include <iterator_range.hpp>

Inheritance diagram for iterator_range:

iterable_range_tag notional_range_tag List of all members.

Notional Range methods

ss_bool_t 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

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 Methods

 iterator_range (iterator first, iterator last)
 Constructs from an iterator pair.

template<typename I2>  iterator_range (I2 first, I2 last)
 Constructs from an iterator pair.

template<typename T2, ss_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.


Detailed Description

template<typename I, typename T = iterator_range_traits<I>>
class stlsoft::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
      }
    }
    


Member Typedef Documentation

typedef iterator_range<I, T> class_type
 

The current instantiation of this type.

typedef traits_type::const_iterator const_iterator
 

The non-mutating (const) iterator type.

typedef traits_type::const_reference const_reference
 

The non-mutating (const) reference type.

typedef traits_type::iterator iterator
 

The mutating (non-const) iterator type.

typedef I iterator_type
 

The iterator type.

typedef iterable_range_tag range_tag_type
 

The range tag type.

typedef traits_type::reference reference
 

The mutating (non-const) refernce type.

typedef T traits_type
 

The traits type.

typedef traits_type::value_type value_type
 

The value type.


Constructor & Destructor Documentation

iterator_range iterator    first,
iterator    last
[inline]
 

Constructs from an iterator pair.

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

class_type& advance   [inline]
 

Advances the current position in the range.

const_iterator begin   const [inline]
 

Returns an iterator to the current position of the range.

iterator begin   [inline]
 

Returns an iterator to the current position of the range.

const_reference current   const [inline]
 

Returns the current value in the range.

reference current   [inline]
 

Returns the current value in the range.

const_iterator end   const [inline]
 

Returns an iterator to the end of the range.

iterator end   [inline]
 

Returns an iterator to the end of the range.

ss_bool_t is_open   const [inline]
 

Indicates whether the range is open.

const_reference operator *   const [inline]
 

Returns the current value in the range.

reference operator *   [inline]
 

Returns the current value in the range.

operator boolean_type   const [inline]
 

Indicates whether the range is open.

class_type operator++ int    [inline]
 

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

class_type& operator++   [inline]
 

Advances the current position in the range.


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

STLSoft Libraries documentation © Synesis Software Pty Ltd, 2001-2004