12 #include <type_traits> 18 #if defined(ARMNN_POLYMORPHIC_CAST_TESTABLE) 19 # define ARMNN_POLYMORPHIC_CAST_CHECK_METHOD(cond) ConditionalThrow<std::bad_cast>(cond) 21 # define ARMNN_POLYMORPHIC_CAST_CHECK_METHOD(cond) ARMNN_ASSERT(cond) 25 #if !defined(NDEBUG) || defined(ARMNN_POLYMORPHIC_CAST_TESTABLE) 26 # define ARMNN_POLYMORPHIC_CAST_CHECK(cond) ARMNN_POLYMORPHIC_CAST_CHECK_METHOD(cond) 28 # define ARMNN_POLYMORPHIC_CAST_CHECK(cond) // release builds dont check the cast 32 template<
typename DestType,
typename SourceType>
35 static_assert(std::is_pointer<SourceType>::value &&
36 std::is_pointer<DestType>::value,
37 "polymorphic_downcast only works with pointer types.");
40 return static_cast<DestType
>(value);
DestType polymorphic_downcast(SourceType value)
Copyright (c) 2020 ARM Limited.
#define ARMNN_POLYMORPHIC_CAST_CHECK(cond)