associative_range Class Template Reference

#include <rangelib/associative_range.hpp>

Inheritance diagram for associative_range:

iterable_range_tag notional_range_tag

List of all members.


Detailed Description

template<typename S, typename T = const_associative_range_traits<S>>
class rangelib::associative_range< S, T >

This class adapts an STL associative instance into a Range.

Parameters:
S The associative class
T The associative 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(associative_range<std::vector<int> > r(numbers); 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 key+value pair in the range.
const_reference current () const
 Returns the current key+value pair in the range.
key_type current_key ()
 Returns the key of the current item in the range.
key_type current_key () const
 Returns the value of the current item in the range.
mapped_type current_value ()
 Returns the value of the current item in the range.
mapped_type current_value () const
 Returns the value of the current item in the range.
class_typeadvance ()
 Advances the current position in the range.
 operator boolean_type () const
 Indicates whether the range is open.
reference operator* ()
 Returns the current key+value pair in the range.
const_reference operator* () const
 Returns the current key+value pair 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 S associative_type
 The associative type.
typedef T traits_type
 The traits type.
typedef iterable_range_tag range_tag_type
 The range category tag type.
typedef associative_range< S, T > class_type
 The current instantiation of the type.
typedef
traits_type::associative_reference_type 
associative_reference_type
 The associative reference type.
typedef traits_type::key_type key_type
 The key type.
typedef traits_type::mapped_type mapped_type
 The referent 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 S2>
 associative_range (S2 &seq)
 Constructor.
 associative_range (class_type const &rhs)
 Copy constructor.
class_typeoperator= (class_type const &rhs)
 Copy assignment operator.
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 associative_type

The associative type.

typedef T traits_type

The traits type.

The range category tag type.

The current instantiation of the type.

typedef traits_type::associative_reference_type associative_reference_type

The associative reference type.

typedef traits_type::key_type key_type

The key type.

typedef traits_type::mapped_type mapped_type

The referent 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.


Constructor & Destructor Documentation

associative_range ( S2 &  seq  )  [inline]

Constructor.

Parameters:
seq The associative which will be adapted to a range

associative_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++

References associative_range::m_last, and associative_range::m_position.

bool is_open (  )  const [inline]

Indicates whether the range is open.

reference current (  )  [inline]

Returns the current key+value pair in the range.

References STLSOFT_ASSERT.

const_reference current (  )  const [inline]

Returns the current key+value pair in the range.

References STLSOFT_ASSERT.

key_type current_key (  )  [inline]

Returns the key of the current item in the range.

key_type current_key (  )  const [inline]

Returns the value of the current item in the range.

mapped_type current_value (  )  [inline]

Returns the value of the current item in the range.

mapped_type current_value (  )  const [inline]

Returns the value of the current item in the range.

class_type& advance (  )  [inline]

Advances the current position in the range.

References STLSOFT_MESSAGE_ASSERT.

operator boolean_type (  )  const [inline]

Indicates whether the range is open.

reference operator* (  )  [inline]

Returns the current key+value pair in the range.

const_reference operator* (  )  const [inline]

Returns the current key+value pair in the range.

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