diff options
author | sereglond <sereglond@yandex-team.ru> | 2022-02-10 16:47:47 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:47 +0300 |
commit | 73bb02f2495181e0719a800f979df508924f4b71 (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /util/string/cast.h | |
parent | eb3d925534734c808602b31b38b953677f0a279f (diff) | |
download | ydb-73bb02f2495181e0719a800f979df508924f4b71.tar.gz |
Restoring authorship annotation for <sereglond@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/string/cast.h')
-rw-r--r-- | util/string/cast.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/util/string/cast.h b/util/string/cast.h index 3d970ea2d8..90e925c194 100644 --- a/util/string/cast.h +++ b/util/string/cast.h @@ -311,18 +311,18 @@ inline T FromStringWithDefault(const TStringType& s) { double StrToD(const char* b, char** se); double StrToD(const char* b, const char* e, char** se); -template <int base, class T> -size_t IntToString(T t, char* buf, size_t len); - -template <int base, class T> +template <int base, class T> +size_t IntToString(T t, char* buf, size_t len); + +template <int base, class T> inline TString IntToString(T t) { static_assert(std::is_arithmetic<std::remove_cv_t<T>>::value, "expect std::is_arithmetic<std::remove_cv_t<T>>::value"); - - char buf[256]; - + + char buf[256]; + return TString(buf, IntToString<base>(t, buf, sizeof(buf))); -} - +} + template <int base, class TInt, class TChar> bool TryIntFromString(const TChar* data, size_t len, TInt& result); @@ -331,18 +331,18 @@ inline bool TryIntFromString(const TStringType& s, TInt& result) { return TryIntFromString<base>(s.data(), s.size(), result); } -template <class TInt, int base, class TChar> -TInt IntFromString(const TChar* str, size_t len); - -template <class TInt, int base, class TChar> -inline TInt IntFromString(const TChar* str) { +template <class TInt, int base, class TChar> +TInt IntFromString(const TChar* str, size_t len); + +template <class TInt, int base, class TChar> +inline TInt IntFromString(const TChar* str) { return IntFromString<TInt, base>(str, std::char_traits<TChar>::length(str)); -} - +} + template <class TInt, int base, class TStringType> inline TInt IntFromString(const TStringType& str) { return IntFromString<TInt, base>(str.data(), str.size()); -} +} static inline TString ToString(const TStringBuf str) { return TString(str); |