106 ALIB_STATIC_ASSERT( SafeCast_not_allowed, std::is_base_of<TTo ALIB_COMMA TFrom>::value
107 || std::is_base_of<TFrom ALIB_COMMA TTo >::value,
108 "TFrom and TTo must be related by inheritance.")
110 if constexpr (std::is_polymorphic<TTo>::value)
return dynamic_cast<TTo*
>(derived);
111 else return static_cast<TTo*
>(derived);