| 5 | struct executable { std::string exe_; }; |
| 6 | |
| 7 | class Ex { |
| 8 | public: |
| 9 | template <typename... Args> |
| 10 | Ex(Args&&... args) { |
| 11 | set_options(std::forward<Args>(args)...); |
| 12 | } |
| 13 | |
| 14 | template <typename T> |
| 15 | void set_options(T&& arg) { |
| 16 | set_option(std::forward<T>(arg)); |
| 17 | } |
| 18 | |
| 19 | template <typename T, typename... Args> |
| 20 | void set_options(T&& first, Args&&... rem_args) { |
| 21 | set_option(std::forward<T>(first)); |
| 22 | set_options(std::forward<Args>(rem_args)...); |
| 23 | } |
| 24 | |
| 25 | void set_option(bufsize&& bufs) { |
| 26 | std::cout << "bufsize opt" << std::endl; |
| 27 | bufsiz_ = bufs.siz_; |
| 28 | } |
| 29 | void set_option(executable&& exe) { |
| 30 | std::cout << "exe opt" << std::endl; |
| 31 | exe_name_ = std::move(exe.exe_); |
| 32 | } |
| 33 | |
| 34 | private: |
| 35 | int bufsiz_ = 0; |
| 36 | std::string exe_name_; |
| 37 | }; |
| 38 | |
| 39 | int main() { |
| 40 | Ex e(bufsize{1}, executable{"finger"}); |
nothing calls this directly
no outgoing calls
no test coverage detected