24#ifndef PXR_BASE_TF_CXX_CAST_H
25#define PXR_BASE_TF_CXX_CAST_H
31#error This include file can only be included in C++ programs.
37PXR_NAMESPACE_OPEN_SCOPE
39template <
class Src,
class Dst>
41 typename std::conditional<std::is_const<Src>::value,
42 typename std::add_const<Dst>::type, Dst>::type;
44template <
class Src,
class Dst>
45using Tf_CopyVolatile =
46 typename std::conditional<std::is_volatile<Src>::value,
47 typename std::add_volatile<Dst>::type, Dst>::type;
49template <
class Src,
class Dst>
50using Tf_CopyCV = Tf_CopyConst<Src, Tf_CopyVolatile<Src, Dst>>;
65inline typename std::enable_if<
66 std::is_polymorphic<T>::value, Tf_CopyCV<T, void>*>::type
69 return dynamic_cast<Tf_CopyCV<T, void>*
>(ptr);
73inline typename std::enable_if<
74 !std::is_polymorphic<T>::value, Tf_CopyCV<T, void>*>::type
77 return static_cast<Tf_CopyCV<T, void>*
>(ptr);
80PXR_NAMESPACE_CLOSE_SCOPE
std::enable_if< std::is_polymorphic< T >::value, Tf_CopyCV< T, void > * >::type TfCastToMostDerivedType(T *ptr)
Return a pointer to the most-derived object.