Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Cabieces
otb
Commits
cbea423c
Commit
cbea423c
authored
6 years ago
by
Julien Michel
Browse files
Options
Downloads
Patches
Plain Diff
ENH: C++17 will ease this
parent
7eeb1909
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/Core/Functor/include/otbFunctorImageFilter.hxx
+9
-1
9 additions, 1 deletion
Modules/Core/Functor/include/otbFunctorImageFilter.hxx
with
9 additions
and
1 deletion
Modules/Core/Functor/include/otbFunctorImageFilter.hxx
+
9
−
1
View file @
cbea423c
...
@@ -62,21 +62,25 @@ template<class T> int SetInputRequestedRegion(const T * img, const itk::ImageReg
...
@@ -62,21 +62,25 @@ template<class T> int SetInputRequestedRegion(const T * img, const itk::ImageReg
}
}
}
}
// Will be easier to write in c++17 with std::apply and fold expressions
template
<
class
Tuple
,
size_t
...
Is
>
auto
SetInputRequestedRegionsImpl
(
Tuple
&
t
,
const
itk
::
ImageRegion
<
2
>
&
region
,
std
::
index_sequence
<
Is
...
>
,
const
itk
::
Size
<
2
>
&
radius
)
template
<
class
Tuple
,
size_t
...
Is
>
auto
SetInputRequestedRegionsImpl
(
Tuple
&
t
,
const
itk
::
ImageRegion
<
2
>
&
region
,
std
::
index_sequence
<
Is
...
>
,
const
itk
::
Size
<
2
>
&
radius
)
{
{
return
std
::
make_tuple
(
SetInputRequestedRegion
(
std
::
get
<
Is
>
(
t
),
region
,
radius
)...);
return
std
::
make_tuple
(
SetInputRequestedRegion
(
std
::
get
<
Is
>
(
t
),
region
,
radius
)...);
}
}
// Will be easier to write in c++17 with std::apply and fold expressions
template
<
typename
...
T
>
auto
SetInputRequestedRegions
(
std
::
tuple
<
T
...
>
&&
t
,
const
itk
::
ImageRegion
<
2
>
&
region
,
const
itk
::
Size
<
2
>
&
radius
)
template
<
typename
...
T
>
auto
SetInputRequestedRegions
(
std
::
tuple
<
T
...
>
&&
t
,
const
itk
::
ImageRegion
<
2
>
&
region
,
const
itk
::
Size
<
2
>
&
radius
)
{
{
return
SetInputRequestedRegionsImpl
(
t
,
region
,
std
::
make_index_sequence
<
sizeof
...(
T
)
>
{},
radius
);
return
SetInputRequestedRegionsImpl
(
t
,
region
,
std
::
make_index_sequence
<
sizeof
...(
T
)
>
{},
radius
);
}
}
// Will be easier to write in c++17 with std::apply and fold expressions
template
<
class
Tuple
,
size_t
...
Is
>
auto
GetNumberOfComponentsPerInputImpl
(
Tuple
&
t
,
std
::
index_sequence
<
Is
...
>
)
template
<
class
Tuple
,
size_t
...
Is
>
auto
GetNumberOfComponentsPerInputImpl
(
Tuple
&
t
,
std
::
index_sequence
<
Is
...
>
)
{
{
return
std
::
array
<
size_t
,
sizeof
...(
Is
)
>
{{
std
::
get
<
Is
>
(
t
)
->
GetNumberOfComponentsPerPixel
()...}};
return
std
::
array
<
size_t
,
sizeof
...(
Is
)
>
{{
std
::
get
<
Is
>
(
t
)
->
GetNumberOfComponentsPerPixel
()...}};
}
}
// Will be easier to write in c++17 with std::apply and fold expressions
template
<
typename
...
T
>
auto
GetNumberOfComponentsPerInput
(
std
::
tuple
<
T
...
>
&
t
)
template
<
typename
...
T
>
auto
GetNumberOfComponentsPerInput
(
std
::
tuple
<
T
...
>
&
t
)
{
{
return
GetNumberOfComponentsPerInputImpl
(
t
,
std
::
make_index_sequence
<
sizeof
...(
T
)
>
{});
return
GetNumberOfComponentsPerInputImpl
(
t
,
std
::
make_index_sequence
<
sizeof
...(
T
)
>
{});
...
@@ -102,12 +106,13 @@ template <> struct MakeIterator<std::true_type>
...
@@ -102,12 +106,13 @@ template <> struct MakeIterator<std::true_type>
}
}
};
};
// Will be easier to write in c++17 with std::apply and fold expressions
template
<
class
TNeigh
,
class
Tuple
,
size_t
...
Is
>
auto
MakeIteratorsImpl
(
const
Tuple
&
t
,
const
itk
::
ImageRegion
<
2
>
&
region
,
const
itk
::
Size
<
2
>
&
radius
,
std
::
index_sequence
<
Is
...
>
,
TNeigh
)
template
<
class
TNeigh
,
class
Tuple
,
size_t
...
Is
>
auto
MakeIteratorsImpl
(
const
Tuple
&
t
,
const
itk
::
ImageRegion
<
2
>
&
region
,
const
itk
::
Size
<
2
>
&
radius
,
std
::
index_sequence
<
Is
...
>
,
TNeigh
)
{
{
return
std
::
make_tuple
(
MakeIterator
<
typename
std
::
tuple_element
<
Is
,
TNeigh
>::
type
>::
Make
(
std
::
get
<
Is
>
(
t
),
region
,
radius
)...);
return
std
::
make_tuple
(
MakeIterator
<
typename
std
::
tuple_element
<
Is
,
TNeigh
>::
type
>::
Make
(
std
::
get
<
Is
>
(
t
),
region
,
radius
)...);
}
}
// Will be easier to write in c++17 with std::apply and fold expressions
template
<
class
TNeigh
,
typename
...
T
>
auto
MakeIterators
(
std
::
tuple
<
T
...
>
&&
t
,
const
itk
::
ImageRegion
<
2
>
&
region
,
const
itk
::
Size
<
2
>
&
radius
,
TNeigh
n
)
template
<
class
TNeigh
,
typename
...
T
>
auto
MakeIterators
(
std
::
tuple
<
T
...
>
&&
t
,
const
itk
::
ImageRegion
<
2
>
&
region
,
const
itk
::
Size
<
2
>
&
radius
,
TNeigh
n
)
{
{
return
MakeIteratorsImpl
(
t
,
region
,
radius
,
std
::
make_index_sequence
<
sizeof
...(
T
)
>
{},
n
);
return
MakeIteratorsImpl
(
t
,
region
,
radius
,
std
::
make_index_sequence
<
sizeof
...(
T
)
>
{},
n
);
...
@@ -133,17 +138,20 @@ template <typename T> struct GetProxy<itk::ConstNeighborhoodIterator<T> >
...
@@ -133,17 +138,20 @@ template <typename T> struct GetProxy<itk::ConstNeighborhoodIterator<T> >
}
}
};
};
// Will be easier to write in c++17 with std::apply and fold expressions
template
<
class
Tuple
,
class
Oper
,
size_t
...
Is
>
auto
CallOperatorImpl
(
Tuple
&
t
,
const
Oper
&
oper
,
std
::
index_sequence
<
Is
...
>
)
template
<
class
Tuple
,
class
Oper
,
size_t
...
Is
>
auto
CallOperatorImpl
(
Tuple
&
t
,
const
Oper
&
oper
,
std
::
index_sequence
<
Is
...
>
)
{
{
return
oper
(
GetProxy
<
typename
std
::
remove_reference
<
decltype
(
std
::
get
<
Is
>
(
t
))
>::
type
>::
Get
(
std
::
get
<
Is
>
(
t
))...);
return
oper
(
GetProxy
<
typename
std
::
remove_reference
<
decltype
(
std
::
get
<
Is
>
(
t
))
>::
type
>::
Get
(
std
::
get
<
Is
>
(
t
))...);
}
}
// Will be easier to write in c++17 with std::apply and fold expressions
template
<
class
Oper
,
typename
...
Args
>
auto
CallOperator
(
const
Oper
&
oper
,
std
::
tuple
<
Args
...
>
&
t
)
template
<
class
Oper
,
typename
...
Args
>
auto
CallOperator
(
const
Oper
&
oper
,
std
::
tuple
<
Args
...
>
&
t
)
{
{
return
CallOperatorImpl
(
t
,
oper
,
std
::
make_index_sequence
<
sizeof
...(
Args
)
>
{});
return
CallOperatorImpl
(
t
,
oper
,
std
::
make_index_sequence
<
sizeof
...(
Args
)
>
{});
}
}
// Variadic move of iterators
// Variadic move of iterators
// Will be easier to write in c++17 with std::apply and fold expressions
template
<
class
Tuple
,
size_t
...
Is
>
auto
MoveIteratorsImpl
(
Tuple
&
t
,
std
::
index_sequence
<
Is
...
>
)
template
<
class
Tuple
,
size_t
...
Is
>
auto
MoveIteratorsImpl
(
Tuple
&
t
,
std
::
index_sequence
<
Is
...
>
)
{
{
return
std
::
make_tuple
(
++
(
std
::
get
<
Is
>
(
t
)
)...);
return
std
::
make_tuple
(
++
(
std
::
get
<
Is
>
(
t
)
)...);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment