diff options
author | Eric Fiselier <eric@efcs.ca> | 2018-07-10 04:02:00 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2018-07-10 04:02:00 +0000 |
commit | fcafd3e6002cb682d737ddf56f1d972358dbfa61 (patch) | |
tree | a1cd9d15d739472558d8c4a325c5b492410d8f51 /libcxx/utils/google-benchmark/src/string_util.h | |
parent | 1c5ae9bc1f557fb27471c20de9fb3697de7f365e (diff) | |
download | bcm5719-llvm-fcafd3e6002cb682d737ddf56f1d972358dbfa61.tar.gz bcm5719-llvm-fcafd3e6002cb682d737ddf56f1d972358dbfa61.zip |
Update google-benchark to trunk
llvm-svn: 336635
Diffstat (limited to 'libcxx/utils/google-benchmark/src/string_util.h')
-rw-r--r-- | libcxx/utils/google-benchmark/src/string_util.h | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/libcxx/utils/google-benchmark/src/string_util.h b/libcxx/utils/google-benchmark/src/string_util.h index c3d53bfd334..4a5501273cf 100644 --- a/libcxx/utils/google-benchmark/src/string_util.h +++ b/libcxx/utils/google-benchmark/src/string_util.h @@ -12,29 +12,45 @@ void AppendHumanReadable(int n, std::string* str); std::string HumanReadableNumber(double n, double one_k = 1024.0); -std::string StringPrintF(const char* format, ...); +std::string StrFormat(const char* format, ...); -inline std::ostream& StringCatImp(std::ostream& out) BENCHMARK_NOEXCEPT { +inline std::ostream& StrCatImp(std::ostream& out) BENCHMARK_NOEXCEPT { return out; } template <class First, class... Rest> -inline std::ostream& StringCatImp(std::ostream& out, First&& f, - Rest&&... rest) { +inline std::ostream& StrCatImp(std::ostream& out, First&& f, Rest&&... rest) { out << std::forward<First>(f); - return StringCatImp(out, std::forward<Rest>(rest)...); + return StrCatImp(out, std::forward<Rest>(rest)...); } template <class... Args> inline std::string StrCat(Args&&... args) { std::ostringstream ss; - StringCatImp(ss, std::forward<Args>(args)...); + StrCatImp(ss, std::forward<Args>(args)...); return ss.str(); } void ReplaceAll(std::string* str, const std::string& from, const std::string& to); +#ifdef BENCHMARK_STL_ANDROID_GNUSTL +/* + * GNU STL in Android NDK lacks support for some C++11 functions, including + * stoul, stoi, stod. We reimplement them here using C functions strtoul, + * strtol, strtod. Note that reimplemented functions are in benchmark:: + * namespace, not std:: namespace. + */ +unsigned long stoul(const std::string& str, size_t* pos = nullptr, + int base = 10); +int stoi(const std::string& str, size_t* pos = nullptr, int base = 10); +double stod(const std::string& str, size_t* pos = nullptr); +#else +using std::stoul; +using std::stoi; +using std::stod; +#endif + } // end namespace benchmark #endif // BENCHMARK_STRING_UTIL_H_ |