aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/utils/cast.h
blob: dac850809221ace65f5f6717b0e790737f8b7226 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#pragma once
#include "yql_panic.h"

namespace NYql {

template<class T, class F>
[[nodiscard]]
inline T EnsureDynamicCast(F from) {
    YQL_ENSURE(from, "source should not be null");
    T result = dynamic_cast<T>(from);
    YQL_ENSURE(result, "dynamic_cast failed");
    return result;
}

} // namespace NYql