[MIPS GlobalISel] Select MSA vector generic and builtin add
[llvm-complete.git] / utils / benchmark / src / string_util.h
blobe70e76987245eabc36f78fda217d4504105ed924
1 #ifndef BENCHMARK_STRING_UTIL_H_
2 #define BENCHMARK_STRING_UTIL_H_
4 #include <sstream>
5 #include <string>
6 #include <utility>
7 #include "internal_macros.h"
9 namespace benchmark {
11 void AppendHumanReadable(int n, std::string* str);
13 std::string HumanReadableNumber(double n, double one_k = 1024.0);
15 std::string StrFormat(const char* format, ...);
17 inline std::ostream& StrCatImp(std::ostream& out) BENCHMARK_NOEXCEPT {
18 return out;
21 template <class First, class... Rest>
22 inline std::ostream& StrCatImp(std::ostream& out, First&& f,
23 Rest&&... rest) {
24 out << std::forward<First>(f);
25 return StrCatImp(out, std::forward<Rest>(rest)...);
28 template <class... Args>
29 inline std::string StrCat(Args&&... args) {
30 std::ostringstream ss;
31 StrCatImp(ss, std::forward<Args>(args)...);
32 return ss.str();
35 void ReplaceAll(std::string* str, const std::string& from,
36 const std::string& to);
38 } // end namespace benchmark
40 #endif // BENCHMARK_STRING_UTIL_H_