Add bench utils
This commit is contained in:
12
bench/utils.hpp
Normal file
12
bench/utils.hpp
Normal 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
|
||||
Reference in New Issue
Block a user