42 #ifndef TEUCHOS_GET_BASE_OBJ_VOID_PTR_HPP
43 #define TEUCHOS_GET_BASE_OBJ_VOID_PTR_HPP
50 #if defined(HAVE_TEUCHOSCORE_CXX11)
51 # define HAS_TEUCHOS_GET_BASE_OBJ_VOID_PTR 1
52 # include <type_traits>
53 #elif defined(HAVE_TEUCHOSCORE_BOOST) && defined(HAVE_TEUCHOSCORE_BOOST_IS_POLYMORPHIC)
54 # define HAS_TEUCHOS_GET_BASE_OBJ_VOID_PTR 1
55 # include <boost/type_traits/is_polymorphic.hpp>
62 #ifdef HAS_TEUCHOS_GET_BASE_OBJ_VOID_PTR
65 template<
bool isPolymorphic,
typename T>
66 class GetBaseObjVoidPtrImpl {};
69 class GetBaseObjVoidPtrImpl<true, T> {
71 static const void* getBaseObjVoidPtr(T *p)
73 return dynamic_cast<const void*
>(p);
79 class GetBaseObjVoidPtrImpl<false, T> {
81 static const void* getBaseObjVoidPtr(T *p)
83 return static_cast<const void*
>(p);
105 const void* getBaseObjVoidPtr(T *p)
107 #if defined(HAVE_TEUCHOSCORE_CXX11)
108 const bool isPoly = std::is_polymorphic<T>::value;
109 #elif defined(HAVE_TEUCHOSCORE_BOOST) && defined(HAVE_TEUCHOSCORE_BOOST_IS_POLYMORPHIC)
110 const bool isPoly = boost::is_polymorphic<T>::value;
112 typedef GetBaseObjVoidPtrImpl<isPoly, T> GBOVPT;
113 return GBOVPT::getBaseObjVoidPtr(p);
117 #endif // HAS_TEUCHOS_GET_BASE_OBJ_VOID_PTR
123 #endif // TEUCHOS_GET_BASE_OBJ_VOID_PTR_HPP
Teuchos header file which uses auto-configuration information to include necessary C++ headers...