// Copyright (c) 2021 The Pybind Development Team. // All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #pragma once #include "common.h" #include PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) PYBIND11_NAMESPACE_BEGIN(detail) template struct dynamic_raw_ptr_cast_is_possible : std::false_type {}; template struct dynamic_raw_ptr_cast_is_possible< To, From, detail::enable_if_t::value && std::is_polymorphic::value>> : std::true_type {}; template ::value, int> = 0> To *dynamic_raw_ptr_cast_if_possible(From * /*ptr*/) { return nullptr; } template ::value, int> = 0> To *dynamic_raw_ptr_cast_if_possible(From *ptr) { return dynamic_cast(ptr); } PYBIND11_NAMESPACE_END(detail) PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)