我想在Mac终端中执行命令队列.是否可以准备包含一系列命令的文件,并通过终端提交文件?例如... commands.txt包含几个命令,每行一个:
./executable_file -f sub_a 100
./executable_file -f sub_b 100
./executable_file -f sub_c 100
./executable_file -f sub_d 100
...
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我想声明一个std::out默认写入的函数,但也可以选择启用写入另一个输出流(如果有的话).例如:
print_function(std::string & str,
std::ostream & out = std::cout,
std::ostream & other = nullptr) // <-- how to make it optional???
{
out << str;
if (other == something) // if optional 'other' argument is provided
{
other << str;
}
}
Run Code Online (Sandbox Code Playgroud)
设置nullprt显然不起作用,但如何做到这一点?