I have a constexpr auto my_tuple = std::make_tuple(a, b, c, d, e);
. Now, I want to apply a constexpr
function over every of its elements. I thought that I could do it like this:
template <typename... Types>
void constexpr apply_func_on_tuple(std::tuple<Types...> tpl) noexcept
{
for (std::size_t i = 0; i < sizeof...(Types); ++i)
{
my_function(std::get<i>(tpl));
}
}
But it doesn't work. I learned why I can't do it this way after reading this. Is there any other way to accomplish what I want fully at compile-time?