Add bench utils

This commit is contained in:
2022-10-03 17:11:33 +02:00
parent 50896e3cd0
commit 2cbff5c8c9
3 changed files with 35 additions and 0 deletions

12
bench/utils.hpp Normal file
View File

@@ -0,0 +1,12 @@
#ifndef UTILS_HPP_
#define UTILS_HPP_
#define _FORMAT(_fmt, ...) \
([&] (void) -> std::string { \
int _sz = std::snprintf(nullptr, 0, _fmt, __VA_ARGS__); \
std::vector<char> _out(_sz + 1); \
std::snprintf(&_out[0], _out.size(), _fmt, __VA_ARGS__); \
return std::string(_out.data()); \
})()
#endif