初始化内容

This commit is contained in:
2026-09-16 14:07:40 +08:00
parent 6934b390bf
commit 4f643c1e7c
18350 changed files with 6088489 additions and 305 deletions
+42
View File
@@ -0,0 +1,42 @@
#include <iostream>
#include <utility>
struct bufsize { int siz_; };
struct executable { std::string exe_; };
class Ex {
public:
template <typename... Args>
Ex(Args&&... args) {
set_options(std::forward<Args>(args)...);
}
template <typename T>
void set_options(T&& arg) {
set_option(std::forward<T>(arg));
}
template <typename T, typename... Args>
void set_options(T&& first, Args&&... rem_args) {
set_option(std::forward<T>(first));
set_options(std::forward<Args>(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;
}