/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <functional>
#include <tuple>
using namespace std;
template <typename... Ts>
class A {
public:
static inline auto funcs = std::make_tuple(std::function<Ts()>()...);
};
auto call = [](auto&&...funcs) {
(funcs(),...);
};
int main()
{
A<int, float, char> l;
std::get<0>(l.funcs) = []() { cout << "Calling int()" << endl; return 1; };
std::get<1>(l.funcs) = []() { cout << "Calling float()" << endl; return 1.f; };
std::get<2>(l.funcs) = []() { cout << "Calling char()" << endl; return '1'; };
std::apply(call, l.funcs);
return 0;
}