I can create a template class that stores some values in a property and let me later call a method that call a function with this arg. Like this :
template <
You may use something like the following:
template class B
{
public:
std::tuple t;
B(Ts... args)
: t(args...)
{
}
void m() { call_f(std::index_sequence_for()); }
private:
template
void call_f(std::index_sequence)
{
f(std::get(t)...);
}
};
Note that std::index_sequence_for
(std::make_index_sequence
) and std::index_sequence
are C++14 but may be written in C++11.
Live example.