CppCMS
sp_convertible.h
1 #ifndef BOOSTER_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED
2 #define BOOSTER_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED
3 
4 
5 // detail/sp_convertible.hpp
6 //
7 // Copyright 2008 Peter Dimov
8 //
9 // Distributed under the Boost Software License, Version 1.0.
10 // See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt
12 
13 #include <booster/config.h>
14 
15 namespace booster
16 {
17 
18 namespace detail
19 {
20 
21 template< class Y, class T > struct sp_convertible
22 {
23  typedef char (&yes) [1];
24  typedef char (&no) [2];
25 
26  static yes f( T* );
27  static no f( ... );
28 
29  enum _vt { value = sizeof( f( static_cast<Y*>(0) ) ) == sizeof(yes) };
30 };
31 
32 struct sp_empty
33 {
34 };
35 
36 template< bool > struct sp_enable_if_convertible_impl;
37 
38 template<> struct sp_enable_if_convertible_impl<true>
39 {
40  typedef sp_empty type;
41 };
42 
43 template<> struct sp_enable_if_convertible_impl<false>
44 {
45 };
46 
47 template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_if_convertible_impl< sp_convertible< Y, T >::value >
48 {
49 };
50 
51 } // namespace detail
52 
53 } // namespace boost
54 
55 #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED
Definition: sp_convertible.h:32
Definition: sp_convertible.h:21
Definition: sp_convertible.h:36
Definition: sp_convertible.h:47
Booster library namespace. The library that implements Boost Like API in ABI backward compatible way...
Definition: application.h:23