I want to use boost hana to generate this final code:
template < typename ... Ts >
void foo(Ts ... data) {
constexpr auto tuple = hana::make_tuple(data...);
//Code that I need to be generate
container_c[tuple[0_c]].foo2();
container_c[tuple[1_c]].foo2();
container_c[tuple[2_c]].foo2();
}
container_c is a map generate at compile time, I'm don't think that it really matter here though. foo2 is not constexpr.
I was thinking using hana::size(tuple).times
but I need an increment, probably using hana::make_range(hana::size_c<0>, hana::size(tuple))
and I don't know how to do it.
I was hoping to find a function which will allow me to execute a function on each member of my tuple inside hana. Something like hana::transform
but for void lambda.
I didn't expect to have some hard time finding how to do it with Hana
, should I just use a specialization like in the old times?
Btw, I'm using gcc 7.1 right now, but you can work on the assumption that I have no compiler restrictions.