DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
CUnaryFunctor.h
1
16
17
#pragma once
18
29
30
#if defined(CUnaryFunctor_RECURSES)
31
#error Recursive header files inclusion detected in CUnaryFunctor.h
32
#else
// defined(CUnaryFunctor_RECURSES)
34
#define CUnaryFunctor_RECURSES
35
36
#if !defined CUnaryFunctor_h
38
#define CUnaryFunctor_h
39
41
// Inclusions
42
#include <iostream>
43
#include "DGtal/base/Common.h"
44
#include "DGtal/base/ConceptUtils.h"
46
47
namespace
DGtal
48
{
49
namespace
concepts
50
{
52
// class CUnaryFunctor
88
template
<
typename
X,
typename
A,
typename
R>
89
struct
CUnaryFunctor
:
boost::Assignable
<X>
90
{
91
92
// ----------------------- Concept checks ------------------------------
93
public
:
94
95
BOOST_CONCEPT_USAGE
(
CUnaryFunctor
)
96
{
97
// x( a ) returns r.
98
ConceptUtils::sameType
(
r
,
x
.operator() (
a
) );
99
}
100
// ------------------------- Private Data --------------------------------
101
private
:
102
X
x
;
103
A
a
;
104
R
r
;
105
// ------------------------- Internals ------------------------------------
106
private
:
107
108
};
// end of concept CUnaryFunctor
109
110
//specialization for references
111
template
<
typename
X,
typename
A,
typename
R>
112
struct
CUnaryFunctor
<X,
A
&, R&> :
boost::Assignable<X>
113
{
114
115
// ----------------------- Concept checks ------------------------------
116
public
:
117
118
BOOST_CONCEPT_USAGE
(
CUnaryFunctor
)
119
{
120
ConceptUtils::sameType
(
getRef
(
r
),
x
.operator() (
getRef
(
a
) ) );
121
}
122
// ------------------------- Private Data --------------------------------
123
private
:
124
X
x
;
125
A
a
;
126
R
r
;
127
// ------------------------- Internals ------------------------------------
128
private
:
129
template
<
typename
T>
130
T&
getRef
(T& t)
131
{
132
return
t;
133
}
134
135
};
// end of concept CUnaryFunctor
136
}
137
}
// namespace DGtal
138
139
// //
141
142
#endif
// !defined CUnaryFunctor_h
143
144
#undef CUnaryFunctor_RECURSES
145
#endif
// else defined(CUnaryFunctor_RECURSES)
DGtal::concepts::ConceptUtils::sameType
void sameType(const T &, const T &)
Definition
ConceptUtils.h:117
DGtal::concepts
Aim: Gathers several functions useful for concept checks.
Definition
CPositiveIrreducibleFraction.h:54
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
A
Definition
testCountedConstPtrOrConstPtr.cpp:43
DGtal::concepts::CUnaryFunctor< X, A &, R & >::BOOST_CONCEPT_USAGE
BOOST_CONCEPT_USAGE(CUnaryFunctor)
Definition
CUnaryFunctor.h:118
DGtal::concepts::CUnaryFunctor< X, A &, R & >::a
A a
Definition
CUnaryFunctor.h:125
DGtal::concepts::CUnaryFunctor< X, A &, R & >::r
R r
Definition
CUnaryFunctor.h:126
DGtal::concepts::CUnaryFunctor< X, A &, R & >::getRef
T & getRef(T &t)
Definition
CUnaryFunctor.h:130
DGtal::concepts::CUnaryFunctor< X, A &, R & >::x
X x
Definition
CUnaryFunctor.h:124
DGtal::concepts::CUnaryFunctor
Aim: Defines a unary functor, which associates arguments to results.
Definition
CUnaryFunctor.h:90
DGtal::concepts::CUnaryFunctor::BOOST_CONCEPT_USAGE
BOOST_CONCEPT_USAGE(CUnaryFunctor)
Definition
CUnaryFunctor.h:95
DGtal::concepts::CUnaryFunctor::a
A a
Definition
CUnaryFunctor.h:103
DGtal::concepts::CUnaryFunctor::x
X x
Definition
CUnaryFunctor.h:102
DGtal::concepts::CUnaryFunctor::r
R r
Definition
CUnaryFunctor.h:104
boost::Assignable
Go to http://www.sgi.com/tech/stl/Assignable.html.
Definition
Boost.dox:32
src
DGtal
base
CUnaryFunctor.h
Generated on
for DGtal by
1.18.0