Version:
3.0.0
Loading...
Searching...
No Matches
autopas
utils
TupleUtils.h
Go to the documentation of this file.
1
7
#pragma once
8
9
#include <tuple>
10
11
namespace
autopas::utils::TupleUtils
{
12
21
template
<
class
T,
class
F>
22
void
for_each
(T &&tuple, F &&f) {
23
std::apply(
24
// function that takes all elements of the tuple as variadic argument
25
[&](
auto
&...t) {
26
// unpack the tuple using a fold (... op pack) with op as the comma operator to apply a lambda on every element
27
// This will cause problems if anyone overloads the comma operator for elements of tuple!
28
(..., f(t));
29
},
30
tuple);
31
}
32
33
}
// namespace autopas::utils::TupleUtils
autopas::utils::TupleUtils
In this namespace some helper functions for std::tuple can be found.
Definition:
namespaces.h:75
autopas::utils::TupleUtils::for_each
void for_each(T &&tuple, F &&f)
Applies a function f on every element of the tuple.
Definition:
TupleUtils.h:22
Generated by
1.9.7