C++ variable arguments with std::string only
问题 I'm trying to create a function that takes a variable amount of std::string arguments and formats a string with it. Example: Test::formatLine(const string::format, ...) { const std::string buffer; va_list args; va_start(args, format); vsprintf(buffer.c_str, format.c_str, args); va_end(args); cout << buffer << endl; } Compiling this snippet errors: Error 1 error C3867: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::c_str': function call missing argument list; use '&std: