DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
ConstIteratorAdapter.h
1
16
17
#pragma once
18
30
31
#if defined(ConstIteratorAdapter_RECURSES)
32
#error Recursive header files inclusion detected in ConstIteratorAdapter.h
33
#else
// defined(ConstIteratorAdapter_RECURSES)
35
#define ConstIteratorAdapter_RECURSES
36
37
#if !defined ConstIteratorAdapter_h
39
#define ConstIteratorAdapter_h
40
42
// Inclusions
43
#include <iostream>
44
#include "DGtal/base/Common.h"
45
#include "DGtal/base/IteratorCirculatorTraits.h"
46
#include <boost/iterator/iterator_adaptor.hpp>
47
#include <boost/utility.hpp>
49
50
namespace
DGtal
51
{
52
54
// template class ConstIteratorAdapter
84
template
<
typename
TIterator,
typename
TLightFunctor,
typename
TReturnType =
typename
TLightFunctor::Value >
85
class
ConstIteratorAdapter
86
:
public
boost::iterator_adaptor< ConstIteratorAdapter<TIterator,TLightFunctor,TReturnType>,
87
TIterator, TReturnType, boost::use_default, TReturnType >
88
{
89
typedef
typename
90
boost::iterator_adaptor< ConstIteratorAdapter<TIterator,TLightFunctor,TReturnType>,
91
TIterator, TReturnType, boost::use_default, TReturnType >
92
Super
;
93
94
friend
class
boost::iterator_core_access;
95
96
public
:
97
98
typedef
typename
IteratorCirculatorTraits<TIterator>::Type
Type
;
99
100
104
ConstIteratorAdapter
() { }
105
112
ConstIteratorAdapter
(TIterator
const
& i, TLightFunctor f)
113
:
Super
(i),
myF
(f) { }
114
120
template
<
121
class
OtherFunctor
122
,
class
OtherIterator
123
,
class
OtherReturnType>
124
ConstIteratorAdapter
(
125
ConstIteratorAdapter<OtherFunctor, OtherIterator, OtherReturnType>
const
& other
126
)
127
:
Super
(other.base()),
myF
(other.
functor
())
128
{}
129
135
TLightFunctor
functor
()
const
136
{
return
myF
; }
137
138
private
:
139
146
typename
Super::reference
dereference
()
const
147
{
return
myF
(*this->base()); }
148
150
TLightFunctor
myF
;
151
};
152
153
154
}
// namespace DGtal
155
156
158
// Includes inline functions.
159
//#include "DGtal/base/ConstIteratorAdapter.ih"
160
161
// //
163
164
#endif
// !defined ConstIteratorAdapter_h
165
166
#undef ConstIteratorAdapter_RECURSES
167
#endif
// else defined(ConstIteratorAdapter_RECURSES)
DGtal::ConstIteratorAdapter::ConstIteratorAdapter
ConstIteratorAdapter()
Definition
ConstIteratorAdapter.h:104
DGtal::ConstIteratorAdapter::ConstIteratorAdapter
ConstIteratorAdapter(ConstIteratorAdapter< OtherFunctor, OtherIterator, OtherReturnType > const &other)
Definition
ConstIteratorAdapter.h:124
DGtal::ConstIteratorAdapter::Super
boost::iterator_adaptor< ConstIteratorAdapter< TIterator, TLightFunctor, TReturnType >, TIterator, TReturnType, boost::use_default, TReturnType > Super
Definition
ConstIteratorAdapter.h:92
DGtal::ConstIteratorAdapter< TIterator, TFunctor, TReturnType >::functor
TFunctor functor() const
Definition
ConstIteratorAdapter.h:135
DGtal::ConstIteratorAdapter::Type
IteratorCirculatorTraits< TIterator >::Type Type
Definition
ConstIteratorAdapter.h:98
DGtal::ConstIteratorAdapter::dereference
Super::reference dereference() const
Definition
ConstIteratorAdapter.h:146
DGtal::ConstIteratorAdapter< TIterator, TFunctor, TReturnType >::myF
TFunctor myF
Definition
ConstIteratorAdapter.h:150
DGtal::ConstIteratorAdapter::ConstIteratorAdapter
ConstIteratorAdapter(TIterator const &i, TLightFunctor f)
Definition
ConstIteratorAdapter.h:112
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::IteratorCirculatorTraits::Type
IteratorCirculatorType< IC >::Type Type
Definition
IteratorCirculatorTraits.h:297
src
DGtal
base
ConstIteratorAdapter.h
Generated on
for DGtal by
1.18.0