5 # ifndef VCCC_LITERAL_FORMATTER_HPP
6 # define VCCC_LITERAL_FORMATTER_HPP
28 explicit Formatter(
const char *format) : format(format), buffer(30) {}
30 template<
typename ...Args>
32 auto size = snprintf(NULL, 0, format, args...);
33 if (buffer.size() <
size + 1)
34 buffer.resize(
size + 1);
35 snprintf(buffer.data(),
size + 1, format, args...);
36 return std::string(buffer.data());
41 std::vector<char> buffer;
59 inline Formatter operator "" _format(
const char *format, std::size_t) {
Definition: directory.h:12
constexpr auto size(const C &c) -> decltype(c.size())
Definition: size.hpp:16