Skip to content

Commit f121139

Browse files
committed
Document helper
1 parent 82b600b commit f121139

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

include/openPMD/binding/python/auxiliary.hpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@ namespace auxiliary
2727
{
2828
auto json_dumps(py::object const &obj) -> std::string;
2929

30+
/*
31+
* Functor is a struct of the form:
32+
*
33+
* struct Functor
34+
* {
35+
* template<typename T>
36+
* static void call(... any kind of argument ...);
37+
* };
38+
*
39+
* The variadic parameter pack (Types) specifies types which to supply for T.
40+
*
41+
* ForEachTypeNested<Functor, T1, T2, ...>::call(...args...) will then
42+
* call Functor::template call<T>() for each type T in T1, T2, ...
43+
* one after another.
44+
*/
3045
template <typename Functor, typename... Types>
3146
struct ForEachType;
3247

@@ -37,7 +52,8 @@ struct ForEachType<Functor, FirstType, OtherTypes...>
3752
static void call(Args &&...args)
3853
{
3954
Functor::template call<FirstType>(args...);
40-
ForEachType<Functor, OtherTypes...>::template call<Args...>(args...);
55+
ForEachType<Functor, OtherTypes...>::template call<Args...>(
56+
std::forward<Args>(args)...);
4157
}
4258
};
4359

0 commit comments

Comments
 (0)