12 #include "Rstrstream.h"
14 using std::streamsize;
16 class istrstream :
public std::istringstream {
18 istrstream(): std::istringstream(){}
19 istrstream(
const char *init):std::istringstream(std::string(init)){}
39 template<
typename ... Args>
40 std::string
FormString(
const std::string& format, Args ... args)
42 size_t cstr_size = snprintf(
nullptr, 0, format.c_str(), args ...) + 1;
43 std::unique_ptr<char[]> buf(
new char[cstr_size]);
44 snprintf(buf.get(), cstr_size, format.c_str(), args ...);
45 return std::string(buf.get(), buf.get() + cstr_size - 1);
std::string FormString(const std::string &format, Args...args)