I have an object of class A
that may be called with different types and returns changed self on each call. For purpose of this question A
will do
struct A {
A call(const int&) {
}
A call(const string& s) {
}
////
} a;
So I have a tuple of unknown types:
std::tuple<Types...> t;
and I want to call a
with each tuple element, so I want to get something like:
b = a;
b = b.call(get<0>(t));
b = b.call(get<1>(t));
b = b.call(get<2>(t));
//...
or
b = a.call(get<0>(t)).call(get<1>(t)).call(get<2>(t)...)
Order is not really important (I mean if call order is reversed of even shuffled it's OK).
I do understand that it's possible to do with recursion but it's quite ugly. Is it possible to achieve without recursion?