00001 #ifndef BOOSTER_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED
00002 #define BOOSTER_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <booster/config.h>
00014
00015 namespace booster
00016 {
00017
00018 namespace detail
00019 {
00020
00021 template< class Y, class T > struct sp_convertible
00022 {
00023 typedef char (&yes) [1];
00024 typedef char (&no) [2];
00025
00026 static yes f( T* );
00027 static no f( ... );
00028
00029 enum _vt { value = sizeof( f( static_cast<Y*>(0) ) ) == sizeof(yes) };
00030 };
00031
00032 struct sp_empty
00033 {
00034 };
00035
00036 template< bool > struct sp_enable_if_convertible_impl;
00037
00038 template<> struct sp_enable_if_convertible_impl<true>
00039 {
00040 typedef sp_empty type;
00041 };
00042
00043 template<> struct sp_enable_if_convertible_impl<false>
00044 {
00045 };
00046
00047 template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_if_convertible_impl< sp_convertible< Y, T >::value >
00048 {
00049 };
00050
00051 }
00052
00053 }
00054
00055 #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED