sequence_range Class Template Reference

#include <rangelib/sequence_range.hpp>

Inheritance diagram for sequence_range:

mutating_operator_adaptor iterable_range_tag notional_range_tag

List of all members.


Detailed Description

template<typename S, typename T = const_sequence_range_traits<S>>
class rangelib::sequence_range< S, T >

This class adapts an STL sequence instance into a Range.

Parameters:
S The sequence class
T The sequence 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

  void dump_elements(std::vector<int> const& numbers)
  {
    for(sequence_range<std::vector<int> > r(numbers); r; ++r)
    {
      std::cout << &r; // Dump the current value to stdout
    }
  }

Public Types

typedef S sequence_type
 The sequence type.
typedef T traits_type
 The traits type.
typedef iterable_range_tag range_tag_type
 The range category tag type.
typedef sequence_range< S, T > class_type
 The current instantiation of the type.
typedef
traits_type::sequence_reference_type 
sequence_reference_type
 The sequence reference 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) reference type.
typedef
traits_type::const_reference 
const_reference
 The non-mutating (const) reference type.
typedef
traits_type::difference_type 
difference_type
 The difference type.
typedef traits_type::size_type size_type
 The size type.

Public Member Functions

template<typename S1>
 sequence_range (S1 &rhs)
 Constructor.
template<size_t N>
 sequence_range (S(&ar)[N])
 Constructs a range over an array.
 sequence_range (iterator position, iterator last)
 Constructs from an iterator.
 sequence_range (class_type const &rhs)
 Copy constructor.
class_typeoperator= (class_type const &rhs)
 Copy assignment operator.
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.
class_typeadvance ()
 Advances the current position in the range.
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 S sequence_type

The sequence type.

typedef T traits_type

The traits type.

Reimplemented from mutating_operator_adaptor.

The range category tag type.

typedef sequence_range<S, T> class_type

The current instantiation of the type.

Reimplemented from mutating_operator_adaptor.

typedef traits_type::sequence_reference_type sequence_reference_type

The sequence reference 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) reference type.

Reimplemented from mutating_operator_adaptor.

typedef traits_type::const_reference const_reference

The non-mutating (const) reference type.

Reimplemented from mutating_operator_adaptor.

typedef traits_type::difference_type difference_type

The difference type.

typedef traits_type::size_type size_type

The size type.


Constructor & Destructor Documentation

sequence_range ( S1 &  rhs  )  [inline]

Constructor.

Parameters:
rhs The sequence which will be adapted to a range

sequence_range ( S(&)  ar[N]  )  [inline]

Constructs a range over an array.

sequence_range ( iterator  position,
iterator  last 
) [inline]

Constructs from an iterator.

Parameters:
position The start position of the range
last The end position of the range

sequence_range ( class_type const &  rhs  )  [inline]

Copy constructor.

Note:
This has to be provided, to avoid precipitating C4217 with Visual C++


Member Function Documentation

class_type& operator= ( class_type const &  rhs  )  [inline]

Copy assignment operator.

Note:
This has to be provided, to avoid precipitating C4217 with Visual C++

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.

class_type& advance (  )  [inline]

Advances the current position in the range.

References STLSOFT_MESSAGE_ASSERT.

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:34 2010 for STLSoft by  doxygen 1.5.6