Closed
Description
This library looks very promising. One thing that's missing is efficient snprintf() like functionality which can print directly to a fixed size buffer with truncation but without any memory allocations.
I would suggest an interface like this:
StringRef format(ArrayRef<char> buffer, StringRef fmt, ArgList args);
In this example, ArrayRef
would be a simplified version of array_view
which is proposed for C++17. You don't need all of the multi-dimensional and striding support, just a generic adapter for any array type container.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3851.pdf
The returned StringRef
references a sub-array of buffer that was filled in by the formatting.
Usage example:
char path_buf[4096];
auto path = format(path_buf, "{}/{}", dir, filename);
Metadata
Assignees
Labels
No labels