#include #include struct bufsize { int siz_; }; struct executable { std::string exe_; }; class Ex { public: template Ex(Args&&... args) { set_options(std::forward(args)...); } template void set_options(T&& arg) { set_option(std::forward(arg)); } template void set_options(T&& first, Args&&... rem_args) { set_option(std::forward(first)); set_options(std::forward(rem_args)...); } void set_option(bufsize&& bufs) { std::cout << "bufsize opt" << std::endl; bufsiz_ = bufs.siz_; } void set_option(executable&& exe) { std::cout << "exe opt" << std::endl; exe_name_ = std::move(exe.exe_); } private: int bufsiz_ = 0; std::string exe_name_; }; int main() { Ex e(bufsize{1}, executable{"finger"}); return 0; }