diff options
author | Andrey Khalyavin <halyavin@gmail.com> | 2022-02-10 16:46:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:30 +0300 |
commit | 4b839d0704ee9be1dabb0310a1f03af24963637b (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/string | |
parent | f773626848a7c7456803654292e716b83d69cc12 (diff) | |
download | ydb-4b839d0704ee9be1dabb0310a1f03af24963637b.tar.gz |
Restoring authorship annotation for Andrey Khalyavin <halyavin@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util/string')
-rw-r--r-- | util/string/cast.cpp | 10 | ||||
-rw-r--r-- | util/string/cast.h | 14 |
2 files changed, 12 insertions, 12 deletions
diff --git a/util/string/cast.cpp b/util/string/cast.cpp index a69eba290d..aa1e65a8e9 100644 --- a/util/string/cast.cpp +++ b/util/string/cast.cpp @@ -69,7 +69,7 @@ namespace { template <class T, unsigned base, class TChar> struct TBasicIntFormatter { static_assert(1 < base && base < 17, "expect 1 < base && base < 17"); - static_assert(std::is_unsigned<T>::value, "TBasicIntFormatter can only handle unsigned integers."); + static_assert(std::is_unsigned<T>::value, "TBasicIntFormatter can only handle unsigned integers."); static inline size_t Format(T value, TChar* buf, size_t len) { Y_ENSURE(len, TStringBuf("zero length")); @@ -105,7 +105,7 @@ namespace { template <class T, unsigned base, class TChar> struct TIntFormatter { static_assert(1 < base && base < 17, "expect 1 < base && base < 17"); - static_assert(std::is_integral<T>::value, "T must be an integral type."); + static_assert(std::is_integral<T>::value, "T must be an integral type."); static inline size_t Format(T value, TChar* buf, size_t len) { using TUFmt = TBasicIntFormatter<std::make_unsigned_t<T>, base, TChar>; @@ -180,7 +180,7 @@ namespace { template <class T, unsigned base, class TChar> struct TBasicIntParser { static_assert(1 < base && base < 17, "Expect 1 < base && base < 17."); - static_assert(std::is_unsigned<T>::value, "TBasicIntParser can only handle unsigned integers."); + static_assert(std::is_unsigned<T>::value, "TBasicIntParser can only handle unsigned integers."); enum : unsigned { BASE_POW_2 = base * base, @@ -270,10 +270,10 @@ namespace { template <class T, unsigned base, class TChar> struct TIntParser { static_assert(1 < base && base < 17, "Expect 1 < base && base < 17."); - static_assert(std::is_integral<T>::value, "T must be an integral type."); + static_assert(std::is_integral<T>::value, "T must be an integral type."); enum { - IsSigned = std::is_signed<T>::value + IsSigned = std::is_signed<T>::value }; using TUnsigned = std::make_unsigned_t<T>; diff --git a/util/string/cast.h b/util/string/cast.h index 6cf7e1f1c5..90e925c194 100644 --- a/util/string/cast.h +++ b/util/string/cast.h @@ -82,9 +82,9 @@ namespace NPrivate { */ template <class T> inline TString ToString(const T& t) { - using TR = std::remove_cv_t<T>; + using TR = std::remove_cv_t<T>; - return ::NPrivate::TToString<TR, std::is_arithmetic<TR>::value>::Cvt((const TR&)t); + return ::NPrivate::TToString<TR, std::is_arithmetic<TR>::value>::Cvt((const TR&)t); } inline const TString& ToString(const TString& s) noexcept { @@ -273,8 +273,8 @@ inline bool TryFromString(const TUtf16String& s, T& result) { template <class T, class TStringType> inline bool TryFromStringWithDefault(const TStringType& s, T& result, const T& def) { return TryFromString<T>(s.data(), s.size(), result, def); -} - +} + template <class T> inline bool TryFromStringWithDefault(const char* s, T& result, const T& def) { return TryFromStringWithDefault<T>(TStringBuf(s), result, def); @@ -296,8 +296,8 @@ inline T FromString(const TChar* data, const size_t len, const T& def) { template <class T, class TStringType> inline T FromStringWithDefault(const TStringType& s, const T& def) { return FromString<T>(s.data(), s.size(), def); -} - +} + template <class T> inline T FromStringWithDefault(const char* s, const T& def) { return FromStringWithDefault<T>(TStringBuf(s), def); @@ -316,7 +316,7 @@ 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"); + static_assert(std::is_arithmetic<std::remove_cv_t<T>>::value, "expect std::is_arithmetic<std::remove_cv_t<T>>::value"); char buf[256]; |