Overview     Usage     Performance Notes     Links tst 0.68 - 23 Jan 2009

iterator_wrapper Struct Template Reference

List of all members.


Detailed Description

template<class BaseIterT, class TraitsT, class IterCatT = std::bidirectional_iterator_tag>
struct iterators::iterator_wrapper< BaseIterT, TraitsT, IterCatT >

Creates a bidirectional iterator from a base implementation, which is required to supply the interface.

 struct iter_impl_sample
 {
    typedef /impl-defined/ reference;
    iter_impl_sample();
    iter_impl_sample(/args/);
    void increment();
    void decrement();
    reference dereference() const;
    template<class OtherIter> bool equal(const OtherIter& rhs);
    void swap(this_type& rhs);
 }; 
(This class is meant for iterators you control - if you need to adapt an existing iterator with different interface, something like boost::iterator_facade is needed.)

The first template parameter is the iterator implementation class. iterator_wrapper does not inherit from this. The second parameter is either const_traits <T> or nonconst_traits <T>, which provide the basic value_type related definitions.

Note that Boost.Iterator will do the same job better, this was provided to avoid the dependency. Future versions may move to Boost instead.

Public Types

typedef BaseIterT base_iter
typedef TraitsT traits_type
typedef iterator_wrapper
< BaseIterT, TraitsT, IterCatT > 
this_type
typedef TraitsT::value_type value_type
typedef TraitsT::pointer pointer
typedef TraitsT::reference reference
typedef TraitsT::const_reference const_reference
typedef IterCatT iterator_category
typedef ptrdiff_t difference_type
typedef size_t size_type

Public Member Functions

 iterator_wrapper ()
template<class SameBase>
 iterator_wrapper (const iterator_wrapper< SameBase, nonconst_traits< value_type >, IterCatT > &it)
 Copy constructor for iterator and constructor from (non-const) iterator for const_iterator.
 iterator_wrapper (const iterator_wrapper &it)
 iterator_wrapper (const base_iter &it)
reference operator* () const
pointer operator-> () const
this_typeoperator++ ()
this_type operator++ (int)
this_typeoperator-- ()
this_type operator-- (int)
template<class SameBase>
this_typeoperator= (const iterator_wrapper< SameBase, nonconst_traits< value_type > > &rhs)
 Assignment from non-const to const_iterator.
this_typeoperator= (const iterator_wrapper< BaseIterT, TraitsT > &rhs)
template<class Base, class Constness>
void swap (iterator_wrapper< Base, Constness > &other)
base_iteriter_base ()
const base_iteriter_base () const

Related Functions

(Note that these are not member functions.)

template<class Base, class Val, class Val2, class Cat>
bool operator< (const iterator_wrapper< Base, Val, Cat > &lhs, const iterator_wrapper< Base, Val2, Cat > &rhs)


Member Typedef Documentation

typedef BaseIterT base_iter

typedef TraitsT traits_type

typedef iterator_wrapper<BaseIterT, TraitsT, IterCatT> this_type

typedef TraitsT::value_type value_type

typedef TraitsT::pointer pointer

typedef TraitsT::reference reference

typedef TraitsT::const_reference const_reference

typedef IterCatT iterator_category

typedef ptrdiff_t difference_type

typedef size_t size_type


Constructor & Destructor Documentation

iterator_wrapper (  )  [inline]

iterator_wrapper ( const iterator_wrapper< SameBase, nonconst_traits< value_type >, IterCatT > &  it  )  [inline]

Copy constructor for iterator and constructor from (non-const) iterator for const_iterator.

iterator_wrapper ( const iterator_wrapper< BaseIterT, TraitsT, IterCatT > &  it  )  [inline]

iterator_wrapper ( const base_iter it  )  [inline]


Member Function Documentation

reference operator* (  )  const [inline]

pointer operator-> (  )  const [inline]

this_type& operator++ (  )  [inline]

this_type operator++ ( int   )  [inline]

this_type& operator-- (  )  [inline]

this_type operator-- ( int   )  [inline]

this_type& operator= ( const iterator_wrapper< SameBase, nonconst_traits< value_type > > &  rhs  )  [inline]

Assignment from non-const to const_iterator.

this_type& operator= ( const iterator_wrapper< BaseIterT, TraitsT > &  rhs  )  [inline]

void swap ( iterator_wrapper< Base, Constness > &  other  )  [inline]

base_iter& iter_base (  )  [inline]

const base_iter& iter_base (  )  const [inline]


Friends And Related Function Documentation

bool operator< ( const iterator_wrapper< Base, Val, Cat > &  lhs,
const iterator_wrapper< Base, Val2, Cat > &  rhs 
) [related]


ternary_tree 0.68 -- by rasmus ekman -- Page generated with Doxygen 1.5.6 on 23 Jan 2009