Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
amdis-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
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
amdis
amdis-core
Commits
3fec45ce
Commit
3fec45ce
authored
5 years ago
by
Praetorius, Simon
Browse files
Options
Downloads
Plain Diff
Merge branch 'feature/apply_for_variadic' into 'master'
extend apply and for_each functions See merge request
!43
parents
51fa4226
823cb0e4
Loading
Loading
1 merge request
!43
extend apply and for_each functions
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/amdis/common/Apply.hpp
+7
-0
7 additions, 0 deletions
src/amdis/common/Apply.hpp
src/amdis/common/ForEach.hpp
+10
-0
10 additions, 0 deletions
src/amdis/common/ForEach.hpp
with
17 additions
and
0 deletions
src/amdis/common/Apply.hpp
+
7
−
0
View file @
3fec45ce
...
...
@@ -41,6 +41,13 @@ namespace AMDiS
return
apply
(
FWD
(
f
),
std
::
forward_as_tuple
(
args
...));
}
template
<
std
::
size_t
N
,
class
Functor
>
constexpr
decltype
(
auto
)
apply_indices
(
Functor
&&
f
)
{
return
Impl_
::
apply_indices_impl
(
FWD
(
f
),
index_t
<
0
>
{},
std
::
make_index_sequence
<
N
>
{});
}
template
<
class
Functor
,
std
::
size_t
N
>
constexpr
decltype
(
auto
)
apply_indices
(
Functor
&&
f
,
index_t
<
N
>
)
{
...
...
This diff is collapsed.
Click to expand it.
src/amdis/common/ForEach.hpp
+
10
−
0
View file @
3fec45ce
...
...
@@ -15,6 +15,16 @@ namespace AMDiS
void
ignored_evaluation
(
std
::
initializer_list
<
T
>&&
)
{
/* do nothing */
}
}
template
<
class
Functor
,
class
...
Args
>
constexpr
void
for_variadic
(
Functor
&&
f
,
Args
&&
...
args
)
{
#if AMDIS_HAS_CXX_FOLD_EXPRESSIONS
(
f
(
FWD
(
args
)),...);
#else
Impl_
::
ignored_evaluation
<
int
>
({
0
,
(
f
(
FWD
(
args
)),
0
)...});
#endif
}
template
<
std
::
size_t
...
I
,
class
Tuple
,
class
Functor
>
constexpr
void
for_each
(
std
::
index_sequence
<
I
...
>
,
Tuple
&&
tuple
,
Functor
&&
f
)
{
...
...
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