sp_convertible.hpp
Go to the documentation of this file.
00001 #ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED
00002 #define BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED
00003 
00004 // MS compatible compilers support #pragma once
00005 
00006 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
00007 # pragma once
00008 #endif
00009 
00010 //  detail/sp_convertible.hpp
00011 //
00012 //  Copyright 2008 Peter Dimov
00013 //
00014 //  Distributed under the Boost Software License, Version 1.0.
00015 //  See accompanying file LICENSE_1_0.txt or copy at
00016 //  http://www.boost.org/LICENSE_1_0.txt
00017 
00018 #include <boost/config.hpp>
00019 
00020 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_NO_SFINAE )
00021 # define BOOST_SP_NO_SP_CONVERTIBLE
00022 #endif
00023 
00024 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ < 303 )
00025 # define BOOST_SP_NO_SP_CONVERTIBLE
00026 #endif
00027 
00028 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x610 )
00029 # define BOOST_SP_NO_SP_CONVERTIBLE
00030 #endif
00031 
00032 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
00033 
00034 namespace boost
00035 {
00036 
00037 namespace detail
00038 {
00039 
00040 template< class Y, class T > struct sp_convertible
00041 {
00042     typedef char (&yes) [1];
00043     typedef char (&no)  [2];
00044 
00045     static yes f( T* );
00046     static no  f( ... );
00047 
00048     enum _vt { value = sizeof( f( (Y*)0 ) ) == sizeof(yes) };
00049 };
00050 
00051 struct sp_empty
00052 {
00053 };
00054 
00055 template< bool > struct sp_enable_if_convertible_impl;
00056 
00057 template<> struct sp_enable_if_convertible_impl<true>
00058 {
00059     typedef sp_empty type;
00060 };
00061 
00062 template<> struct sp_enable_if_convertible_impl<false>
00063 {
00064 };
00065 
00066 template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_if_convertible_impl< sp_convertible< Y, T >::value >
00067 {
00068 };
00069 
00070 } // namespace detail
00071 
00072 } // namespace boost
00073 
00074 #endif // !defined( BOOST_SP_NO_SP_CONVERTIBLE )
00075 
00076 #endif  // #ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:29