diff options
author | Evgeny Grechnikov <diamondaz@yandex.ru> | 2022-02-10 16:46:20 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:20 +0300 |
commit | c73494e681a4e497ae191ada07a55a6bf55885ff (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/string/cast.h | |
parent | 6e38f52f898d7c077ddd319800b4014967a5ca76 (diff) | |
download | ydb-c73494e681a4e497ae191ada07a55a6bf55885ff.tar.gz |
Restoring authorship annotation for Evgeny Grechnikov <diamondaz@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/string/cast.h')
-rw-r--r-- | util/string/cast.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/util/string/cast.h b/util/string/cast.h index f5ef2aa184..90e925c194 100644 --- a/util/string/cast.h +++ b/util/string/cast.h @@ -29,7 +29,7 @@ inline size_t ToString(const T& t, char* buf, size_t len) { /** * Floating point to string conversion mode, values are enforced by `dtoa_impl.cpp`. */ -enum EFloatToStringMode { +enum EFloatToStringMode { /** 0.1f -> "0.1", 0.12345678f -> "0.12345678", ignores ndigits. */ PREC_AUTO = 0, @@ -44,18 +44,18 @@ enum EFloatToStringMode { /** same as PREC_POINT_DIGITS, but stripping trailing zeroes: * 0.1f for ndgigits=6 -> "0.1" */ PREC_POINT_DIGITS_STRIP_ZEROES = 4 -}; - -size_t FloatToString(float t, char* buf, size_t len, EFloatToStringMode mode = PREC_AUTO, int ndigits = 0); -size_t FloatToString(double t, char* buf, size_t len, EFloatToStringMode mode = PREC_AUTO, int ndigits = 0); - +}; + +size_t FloatToString(float t, char* buf, size_t len, EFloatToStringMode mode = PREC_AUTO, int ndigits = 0); +size_t FloatToString(double t, char* buf, size_t len, EFloatToStringMode mode = PREC_AUTO, int ndigits = 0); + template <typename T> inline TString FloatToString(const T& t, EFloatToStringMode mode = PREC_AUTO, int ndigits = 0) { - char buf[512]; // Max<double>() with mode = PREC_POINT_DIGITS has 309 digits before the decimal point - size_t count = FloatToString(t, buf, sizeof(buf), mode, ndigits); + char buf[512]; // Max<double>() with mode = PREC_POINT_DIGITS has 309 digits before the decimal point + size_t count = FloatToString(t, buf, sizeof(buf), mode, ndigits); return TString(buf, count); -} - +} + namespace NPrivate { template <class T, bool isSimple> struct TToString { |