template<class Msg, class... Args>
std::wstring descf(Msg, Args&&... args) {
std::wostringstream woss;
owss << Msg << ". " << ... << " " << args << ": '" << args << "' ";//not legal at all
//or
owss << Msg << ". " << args[0] << ": '" << args[1] << "' " << args[2] << ": '" << args[3] << "' "; //... pseudo code, and so on...
}
我知道我可以只使用成对的列表或类似的列表,但是我对如何做到这一点同时保持函数的语法感兴趣:
const auto formatted = descf(L"message", "arg1", arg1, "arg2", arg2);