How can a static constexpr class::method (int i1, int i2, int i3)
be invoked, having input data available as tuple<int, int, int>
in a constexpr way.
The default approach is using std::apply to apply each tuple element as argument to a function.
A minimal example to visualize, what I try to achieve looks like:
struct a {
template <typename T>
static constexpr void test(int i1, int i2, int i3) {
// ...
}
};
struct b : a {};
struct c {};
template <typename T>
struct test_functor {
constexpr test_functor_t() {} // just for testing to express constexpr desire
constexpr void operator()(auto... args) {
T::test<c>(args...);
}
};
constexpr std::tuple<int, int, int> tupl{ 1,2,3 };
constexpr test_functor<b> f;
std::apply(f, tupl);
this works at runtime, but fails to compile constexpr
. How can this be implemented?