cast.h 311 B

123456789101112131415
  1. #pragma once
  2. #include "yql_panic.h"
  3. namespace NYql {
  4. template<class T, class F>
  5. [[nodiscard]]
  6. inline T EnsureDynamicCast(F from) {
  7. YQL_ENSURE(from, "source should not be null");
  8. T result = dynamic_cast<T>(from);
  9. YQL_ENSURE(result, "dynamic_cast failed");
  10. return result;
  11. }
  12. } // namespace NYql