10 template<
class ... Args>
13 implFormat(
stk,
sizeof(
stk)-1, at, arg...);
14 if(at+1<
sizeof(
stk)) {
18 heap =
new char[at+1];
22 implFormat(
heap,
size_t(-1), at, arg...);
31 std::swap(
stk,other.stk);
35 std::swap(
stk,other.stk);
39 inline operator std::string_view()
const {
66 return stk+std::strlen(
stk);
69 inline const char*
begin()
const {
75 inline const char*
end()
const {
78 return stk+std::strlen(
stk);
88 char stk[storageSz] = {};
92 void implFormat(
char* out,
size_t maxSz,
size_t& at) {
96 template<
class ... Args>
97 void implFormat(
char* out,
size_t maxSz,
size_t& at,
const Args&... arg) {
98 (implWrite(out,maxSz,at,arg),... );
102 void implWrite(
char* out,
size_t maxSz,
size_t& at,
const std::string_view& arg) {
103 for(
size_t i=0; i<arg.size(); ++i) {
111 void implWrite(
char* out,
size_t maxSz,
size_t& at,
const char* arg) {
112 for(
size_t i=0; arg[i]; ++i) {
120 void implWrite(
char* out,
size_t maxSz,
size_t& at,
char arg) {
126 void implWrite(
char* out,
size_t maxSz,
size_t& at,
int arg) {
128 std::snprintf(buf,
sizeof(buf),
"%d",arg);
129 implWrite(out, maxSz, at, buf);
132 void implWrite(
char* out,
size_t maxSz,
size_t& at,
unsigned arg) {
134 std::snprintf(buf,
sizeof(buf),
"%u",arg);
135 implWrite(out, maxSz, at, buf);
138 void implWrite(
char* out,
size_t maxSz,
size_t& at,
size_t arg) {
140 std::snprintf(buf,
sizeof(buf),
"%u",uint32_t(arg));
141 implWrite(out, maxSz, at, buf);
144 void implWrite(
char* out,
size_t maxSz,
size_t& at,
float arg) {
146 std::snprintf(buf,
sizeof(buf),
"%f",arg);
147 implWrite(out, maxSz, at, buf);
150 void implWrite(
char* out,
size_t maxSz,
size_t& at,
double arg) {
152 std::snprintf(buf,
sizeof(buf),
"%f",arg);
153 implWrite(out, maxSz, at, buf);
156 void implWrite(
char* out,
size_t maxSz,
size_t& at,
const void* arg) {
158 std::snprintf(buf,
sizeof(buf),
"%p",arg);
159 implWrite(out, maxSz, at, buf);