#pragma once #include #include template std::string string_format(const std::string& format, Args ... args) { size_t size = snprintf(nullptr, 0, format.c_str(), args ...) + 1; std::unique_ptr buf(new char[size]); snprintf(buf.get(), size, format.c_str(), args ...); return std::string(buf.get(), buf.get() + size - 1); }