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);