MCPcopy Create free account
hub / github.com/Illation/ETEngine / string_format

Function string_format

Engine/source/EtCore/Util/StringUtil.h:21–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19//
20template<typename ... Args>
21std::string string_format(char const* format = nullptr, Args ... args)
22{
23 if (format == nullptr)
24 {
25 return std::string();
26 }
27
28 size_t size = snprintf(nullptr, 0, format, args ...) + 1; // Extra space for '\0'
29 std::unique_ptr<char[]> buf(new char[size]);
30 snprintf(buf.get(), size, format, args ...);
31 return std::string(buf.get(), buf.get() + size - 1); // We don't want the '\0' inside
32}
33
34
35} // namespace core

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected