summaryrefslogtreecommitdiffstats
path: root/lib/libcxx/utils/google-benchmark/src/string_util.h
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2019-02-04 16:55:44 +0000
committerpatrick <patrick@openbsd.org>2019-02-04 16:55:44 +0000
commit76c648e7a477ffb2a882ad5ffe523269bd9a3f6a (patch)
tree29d319d598650bab04e4f58e5e8769567e33091e /lib/libcxx/utils/google-benchmark/src/string_util.h
parentImport libc++abi 7.0.1. (diff)
downloadwireguard-openbsd-76c648e7a477ffb2a882ad5ffe523269bd9a3f6a.tar.xz
wireguard-openbsd-76c648e7a477ffb2a882ad5ffe523269bd9a3f6a.zip
Import libc++ 7.0.1.
Diffstat (limited to 'lib/libcxx/utils/google-benchmark/src/string_util.h')
-rw-r--r--lib/libcxx/utils/google-benchmark/src/string_util.h30
1 files changed, 23 insertions, 7 deletions
diff --git a/lib/libcxx/utils/google-benchmark/src/string_util.h b/lib/libcxx/utils/google-benchmark/src/string_util.h
index 0b190b91a16..4a5501273cf 100644
--- a/lib/libcxx/utils/google-benchmark/src/string_util.h
+++ b/lib/libcxx/utils/google-benchmark/src/string_util.h
@@ -10,31 +10,47 @@ namespace benchmark {
void AppendHumanReadable(int n, std::string* str);
-std::string HumanReadableNumber(double n);
+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_