GroupedElementIterator Class Template Reference

A class for direct iteration over containers of containers of objects. More...

#include <grouped_element_iterator.hpp>

Inheritance diagram for GroupedElementIterator:

boost::iterator_facade List of all members.

Public Member Functions

 GroupedElementIterator ()
 Default Constructor.
template<typename GI, typename EI, typename GT, typename ET>
 GroupedElementIterator (GroupedElementIterator< GI, EI, GT, ET > const &other, ElementIterator(GroupType::*group_begin_fun)()=&GroupType::begin, ElementIterator(GroupType::*group_end_fun)()=&GroupType::end, typename boost::enable_if< boost::is_convertible< GI, GroupIterator > >::type *d1=0, typename boost::enable_if< boost::is_convertible< EI, ElementIterator > >::type *d2=0, typename boost::enable_if< boost::is_convertible< GT, GroupType > >::type *d3=0, typename boost::enable_if< boost::is_convertible< ET, ElementType > >::type *d4=0)
 Generic conversion constructor.

Friends

class GroupedElementIterator
class boost::iterator_core_access
std::ostream & operator<< (std::ostream &os, GroupedElementIterator< GroupIterator, ElementIterator, GroupType, ElementType > const &gei)

Classes

class  dc_mem_fun_ref

Detailed Description

template<typename GroupIterator, typename ElementIterator, typename GroupType, typename ElementType>
class BTK::UTILITY::GroupedElementIterator< GroupIterator, ElementIterator, GroupType, ElementType >

A class for direct iteration over containers of containers of objects.

This iterator allows the iteration over containers of containers (groups) of elements, as if the elements were stored contiguously in a single container. It is a true Bidirectional Iterator, and thus supports forward and backward iteration over every element in a defined range. Past-the-end iteration is undefined.

Four template arguments are required:


Constructor & Destructor Documentation

GroupedElementIterator (  ) 

Default Constructor.

By default, the iterator is initialized so as to minimize the chance of NULL-ptr dereferences. Practically, this means that you shouldn't count on pointer-like behaviour when iterating on default-constructed (or past-the-end) GroupedElementIterator objects.

GroupedElementIterator ( GroupIterator  begin,
GroupIterator  end,
ElementIterator(GroupType::*)()  group_begin_fun,
ElementIterator(GroupType::*)()  group_end_fun,
bool  at_end = false 
)

Construct GroupedElementIterators from a range of element groups.

GroupedElementIterator ( GroupIterator  begin,
GroupIterator  end,
bool  at_end = false 
)

Construct GroupedElementIterators from a range of element groups.

GroupedElementIterator ( GroupedElementIterator< GI, EI, GT, ET > const &  other,
ElementIterator(GroupType::*)()  group_begin_fun = &GroupType::begin,
ElementIterator(GroupType::*)()  group_end_fun = &GroupType::end,
typename boost::enable_if< boost::is_convertible< GI, GroupIterator > >::type *  d1 = 0,
typename boost::enable_if< boost::is_convertible< EI, ElementIterator > >::type *  d2 = 0,
typename boost::enable_if< boost::is_convertible< GT, GroupType > >::type *  d3 = 0,
typename boost::enable_if< boost::is_convertible< ET, ElementType > >::type *  d4 = 0 
)

Generic conversion constructor.

This allows GroupedElementIterator objects with a constant referent to be constructed from GroupedElementIterator objects with a non-constant referent (or, in english, to allow const_iterator types to be constructed from iterator types).

The constructor can be called with any instance of GroupedElementIterator whose template parameters are convertible to the template parameters of this class (use of boost::enable_if prevents calls to this constructor with template arguments that are not convertible).

Optionally, two additional arguments can be provided to pass function pointers that return the begin and end iterators for each group in the range (the GroupType::begin() and GroupType::end() methods are used by default -- arguments 2 and 3 allow different methods to be specified).

GroupedElementIterator ( GroupIterator  begin,
GroupIterator  end,
ElementIterator(GroupType::*)()  group_begin_fun,
ElementIterator(GroupType::*)()  group_end_fun,
bool  at_end = false 
)

Construct GroupedElementIterators from a range of element groups.

GroupedElementIterator ( GroupIterator  begin,
GroupIterator  end,
bool  at_end = false 
)

Construct GroupedElementIterators from a range of element groups.


Friends And Related Function Documentation

friend class GroupedElementIterator [friend]

friend class boost::iterator_core_access [friend]

std::ostream& operator<< ( std::ostream &  os,
GroupedElementIterator< GroupIterator, ElementIterator, GroupType, ElementType > const &  gei 
) [friend]


The documentation for this class was generated from the following file:
Generated on Sun Jul 15 20:46:43 2007 for BTK Core by  doxygen 1.5.1