aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/cast.h
diff options
context:
space:
mode:
authornga <nga@yandex-team.ru>2022-02-10 16:48:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:09 +0300
commitc2a1af049e9deca890e9923abe64fe6c59060348 (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /util/generic/cast.h
parent1f553f46fb4f3c5eec631352cdd900a0709016af (diff)
downloadydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/cast.h')
-rw-r--r--util/generic/cast.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/util/generic/cast.h b/util/generic/cast.h
index 1868a7a36b..0d4a41f385 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