How can I format a std::string using a collection of arguments?
问题 Is it possible to format std::string passing a set of arguments? Currently I am formatting the string this way: string helloString = "Hello %s and %s"; vector<string> tokens; //initialized vector of strings const char* helloStringArr = helloString.c_str(); char output[1000]; sprintf_s(output, 1000, helloStringArr, tokens.at(0).c_str(), tokens.at(1).c_str()); But the size of the vector is determined at runtime. Is there any similar function to sprintf_s which takes a collection of arguments