diff options
author | nga <nga@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
commit | 1f553f46fb4f3c5eec631352cdd900a0709016af (patch) | |
tree | a231fba2c03b440becaea6c86a2702d0bfb0336e /util/generic/cast.h | |
parent | c4de7efdedc25b49cbea74bd589eecb61b55b60a (diff) | |
download | ydb-1f553f46fb4f3c5eec631352cdd900a0709016af.tar.gz |
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/cast.h')
-rw-r--r-- | util/generic/cast.h | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/util/generic/cast.h b/util/generic/cast.h index 0d4a41f385..1868a7a36b 100644 --- a/util/generic/cast.h +++ b/util/generic/cast.h @@ -10,37 +10,37 @@ #include <cstdlib> -template <class T, class F> -static inline T VerifyDynamicCast(F f) { - if (!f) { +template <class T, class F> +static inline T VerifyDynamicCast(F f) { + if (!f) { return nullptr; - } - - T ret = dynamic_cast<T>(f); - + } + + T ret = dynamic_cast<T>(f); + Y_VERIFY(ret, "verify cast failed"); - - return ret; -} - + + return ret; +} + #if !defined(NDEBUG) #define USE_DEBUG_CHECKED_CAST #endif -namespace NPrivate { - template <typename T, typename F> - static T DynamicCast(F f) { - return dynamic_cast<T>(f); - } -} - +namespace NPrivate { + template <typename T, typename F> + static T DynamicCast(F f) { + return dynamic_cast<T>(f); + } +} + /* * replacement for dynamic_cast(dynamic_cast in debug mode, else static_cast) */ template <class T, class F> static inline T CheckedCast(F f) { #if defined(USE_DEBUG_CHECKED_CAST) - return VerifyDynamicCast<T>(f); + return VerifyDynamicCast<T>(f); #else /* Make sure F is polymorphic. * Without this cast, CheckedCast with non-polymorphic F |