using namespace std;
class Foo
{
public:
template<typename... T>
void Init(T&... args)
{
cout << __FUNCTION__ << endl;
Print(args...);
using pmf_type = void (Foo::*)(T&...);
mf_ = std::bind((pmf_type)&Foo::Reset, this, args...);
}
template<typename... T>
void Reset(T&... args)
{
cout << __FUNCTION__ << endl;
Print(args...);
}
std::function<void()> mf_;
private:
template<typename F>
void Print(F&& arg)
{
cout << arg << endl;
}
template<typename First, typename... Rest>
void Print(First&& arg, Rest&&... args)
{
cout << arg;
Print(args...);
}
};