10 #ifndef TEUCHOS_GET_BASE_OBJ_VOID_PTR_HPP
11 #define TEUCHOS_GET_BASE_OBJ_VOID_PTR_HPP
14 #include "TeuchosCore_ConfigDefs.hpp"
18 #if defined(HAVE_TEUCHOSCORE_CXX11)
19 # define HAS_TEUCHOS_GET_BASE_OBJ_VOID_PTR 1
20 # include <type_traits>
21 #elif defined(HAVE_TEUCHOSCORE_BOOST) && defined(HAVE_TEUCHOSCORE_BOOST_IS_POLYMORPHIC)
22 # define HAS_TEUCHOS_GET_BASE_OBJ_VOID_PTR 1
23 # include <boost/type_traits/is_polymorphic.hpp>
30 #ifdef HAS_TEUCHOS_GET_BASE_OBJ_VOID_PTR
33 template<
bool isPolymorphic,
typename T>
34 class GetBaseObjVoidPtrImpl {};
37 class GetBaseObjVoidPtrImpl<true, T> {
39 static const void* getBaseObjVoidPtr(T *p)
41 return dynamic_cast<const void*
>(p);
47 class GetBaseObjVoidPtrImpl<false, T> {
49 static const void* getBaseObjVoidPtr(T *p)
51 return static_cast<const void*
>(p);
73 const void* getBaseObjVoidPtr(T *p)
75 #if defined(HAVE_TEUCHOSCORE_CXX11)
76 const bool isPoly = std::is_polymorphic<T>::value;
77 #elif defined(HAVE_TEUCHOSCORE_BOOST) && defined(HAVE_TEUCHOSCORE_BOOST_IS_POLYMORPHIC)
78 const bool isPoly = boost::is_polymorphic<T>::value;
80 typedef GetBaseObjVoidPtrImpl<isPoly, T> GBOVPT;
81 return GBOVPT::getBaseObjVoidPtr(p);
85 #endif // HAS_TEUCHOS_GET_BASE_OBJ_VOID_PTR
91 #endif // TEUCHOS_GET_BASE_OBJ_VOID_PTR_HPP
Teuchos header file which uses auto-configuration information to include necessary C++ headers...