1 #ifndef BENCHMARK_STRING_UTIL_H_
2 #define BENCHMARK_STRING_UTIL_H_
9 #include "benchmark/export.h"
11 #include "internal_macros.h"
15 void AppendHumanReadable(
int n, std::string* str);
17 std::string HumanReadableNumber(
double n,
double one_k = 1024.0);
20 #if defined(__MINGW32__)
21 __attribute__((format(__MINGW_PRINTF_FORMAT, 1, 2)))
22 #elif defined(__GNUC__)
23 __attribute__((format(printf, 1, 2)))
26 StrFormat(
const char* format, ...);
28 inline std::ostream& StrCatImp(std::ostream& out) BENCHMARK_NOEXCEPT {
32 template <
class First,
class... Rest>
33 inline std::ostream& StrCatImp(std::ostream& out, First&& f, Rest&&... rest) {
34 out << std::forward<First>(f);
35 return StrCatImp(out, std::forward<Rest>(rest)...);
38 template <
class... Args>
39 inline std::string StrCat(Args&&... args) {
40 std::ostringstream ss;
41 StrCatImp(ss, std::forward<Args>(args)...);
46 std::vector<std::string> StrSplit(
const std::string& str,
char delim);
50 #ifdef BENCHMARK_STL_ANDROID_GNUSTL
57 unsigned long stoul(
const std::string& str,
size_t* pos =
nullptr,
59 int stoi(
const std::string& str,
size_t* pos =
nullptr,
int base = 10);
60 double stod(
const std::string& str,
size_t* pos =
nullptr);