I want to implement something like the following member function (method), which is supposed to increase each argument by some summand (addend) corresponding to the argument index and forward it to another variadic-template function:
template<typename... Int> // a bunch of integral types (e.g. int, size_t, char)
void ForwardToFuncIncreased(Int... ints) {
static_assert(sizeof...(Ints) == std::tuple_size<decltype(summands_)>::value,
"Incorrect number of integral types provided");
Func( (ints + std::get<PARAM_INDEX(ints)>(summands_))... ); // failed attempt
}
where summands_
is a member variable of type std::tuple
or std::array
(you can assume either). The basic requirement is that it should have no runtime overhead compared to:
Func(int0 + std::get<0>(summands_), int1 + std::get<1>(summands_), ...);
(Imagine I overload the function for up to N
template parameters).
If it is not possible to do it without necessary runtime overhead, I am willing to go with certain modifications (esp. in the way of storing additional stuff in my class or modifying the type).
Note: My intention is not to extract the template argument indexes, but hopefully to achieve what I need without it.