DGtal 1.3.0
Loading...
Searching...
No Matches
IteratorAdapter.h
1
17#pragma once
18
31#if defined(IteratorAdapter_RECURSES)
32#error Recursive header files inclusion detected in IteratorAdapter.h
33#else // defined(IteratorAdapter_RECURSES)
35#define IteratorAdapter_RECURSES
36
37#if !defined IteratorAdapter_h
39#define IteratorAdapter_h
40
42// Inclusions
43#include <iostream>
44#include "DGtal/base/Common.h"
45#include <boost/iterator/transform_iterator.hpp>
47
48namespace DGtal
49{
50
52 // template class IteratorAdapter
75 template <typename TIterator, typename TFunctor, typename TReturnType = typename TFunctor::Value>
77 public boost::transform_iterator< TFunctor, TIterator, TReturnType&, TReturnType >
78 {
79
81
82 public:
83
87 typedef boost::transform_iterator< TFunctor, TIterator, TReturnType&, TReturnType > Parent;
88
99 IteratorAdapter( const TIterator& iter, TFunctor func ): Parent(iter,func) {}
105 IteratorAdapter( const Self& other ): Parent( static_cast<const Parent&>(other) ) {}
111 IteratorAdapter( const Parent& other ): Parent(other) {}
118 Self& operator=( const Self& other )
119 {
120 if (this != &other)
121 Parent::operator=( static_cast<const Parent&>(other) );
122 return *this;
123 }
130 Self& operator=( const Parent& other )
131 {
132 if (this != &other)
133 Parent::operator=(other);
134 return *this;
135 }
141 };
142
143} // namespace DGtal
144
145
147// Includes inline functions.
148//#include "DGtal/base/IteratorAdapter.ih"
149
150// //
152
153#endif // !defined IteratorAdapter_h
154
155#undef IteratorAdapter_RECURSES
156#endif // else defined(IteratorAdapter_RECURSES)
This class adapts any lvalue iterator so that operator* returns a member on the element pointed to by...
IteratorAdapter< TIterator, TFunctor, TReturnType > Self
Self & operator=(const Parent &other)
boost::transform_iterator< TFunctor, TIterator, TReturnType &, TReturnType > Parent
BOOST_CONCEPT_ASSERT((boost_concepts::LvalueIteratorConcept< TIterator >))
IteratorAdapter(const Self &other)
IteratorAdapter(const TIterator &iter, TFunctor func)
IteratorAdapter(const Parent &other)
Self & operator=(const Self &other)
DGtal is the top-level namespace which contains all DGtal functions and types.
Go to http://www.boost.org/doc/libs/1_52_0/libs/iterator/doc/LvalueIteratorConcept....