21 #ifndef OSPL_DDS_CORE_DETAIL_REF_TRAITS_HPP_ 22 #define OSPL_DDS_CORE_DETAIL_REF_TRAITS_HPP_ 34 #if defined(OSPL_USE_CXX11) 36 # include <type_traits> 37 # define OSPL_CXX11_STD_MODULE ::std 40 #elif defined(OSPL_USE_TR1) 43 # include <type_traits> 45 # include <tr1/memory> 46 # include <tr1/type_traits> 48 # define OSPL_CXX11_STD_MODULE ::std::tr1 51 #elif defined(OSPL_USE_BOOST) 52 # include <boost/shared_ptr.hpp> 53 # include <boost/weak_ptr.hpp> 54 # include <boost/type_traits.hpp> 55 # define OSPL_CXX11_STD_MODULE ::boost 58 # error "macros.hpp header not included or other unexpected misconfiguration" 61 template <
typename T1,
typename T2>
62 struct dds::core::is_base_of :
63 #if defined (OSPL_USE_BOOST) && ! defined (BOOST_TT_IS_BASE_OF_HPP_INCLUDED) 64 # include "boost/type_traits/is_base_and_derived.hpp" 65 ::boost::detail::is_base_and_derived_impl<T1, T2> { };
67 public OSPL_CXX11_STD_MODULE::is_base_of<T1, T2> { };
70 template <
typename T1,
typename T2>
71 struct dds::core::is_same :
public OSPL_CXX11_STD_MODULE::is_same<T1, T1> { };
74 struct dds::core::smart_ptr_traits
76 typedef OSPL_CXX11_STD_MODULE::shared_ptr<T> ref_type;
77 typedef OSPL_CXX11_STD_MODULE::weak_ptr<T> weak_ref_type;
80 template <
typename TO,
typename FROM>
81 TO dds::core::polymorphic_cast(FROM& from)
83 typename TO::DELEGATE_REF_T dr =
84 OSPL_CXX11_STD_MODULE::dynamic_pointer_cast<
typename TO::DELEGATE_T>(from.delegate());
87 if(to == dds::core::null)
Exception: Application has attempted to cast incompatible types.