sp_convertible.hpp
Go to the documentation of this file.
1 #ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED
2 #define BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED
3 
4 // MS compatible compilers support #pragma once
5 
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
7 # pragma once
8 #endif
9 
10 // detail/sp_convertible.hpp
11 //
12 // Copyright 2008 Peter Dimov
13 //
14 // Distributed under the Boost Software License, Version 1.0.
15 // See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt
17 
18 #include <boost/config.hpp>
19 #include <cstddef>
20 
21 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_NO_SFINAE )
22 # define BOOST_SP_NO_SP_CONVERTIBLE
23 #endif
24 
25 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ < 303 )
26 # define BOOST_SP_NO_SP_CONVERTIBLE
27 #endif
28 
29 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x630 )
30 # define BOOST_SP_NO_SP_CONVERTIBLE
31 #endif
32 
33 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
34 
35 namespace boost
36 {
37 
38 namespace detail
39 {
40 
41 template< class Y, class T > struct sp_convertible
42 {
43  typedef char (&yes) [1];
44  typedef char (&no) [2];
45 
46  static yes f( T* );
47  static no f( ... );
48 
49  enum _vt { value = sizeof( (f)( static_cast<Y*>(0) ) ) == sizeof(yes) };
50 };
51 
52 template< class Y, class T > struct sp_convertible< Y, T[] >
53 {
54  enum _vt { value = false };
55 };
56 
57 template< class Y, class T > struct sp_convertible< Y[], T[] >
58 {
60 };
61 
62 template< class Y, std::size_t N, class T > struct sp_convertible< Y[N], T[] >
63 {
65 };
66 
67 struct sp_empty
68 {
69 };
70 
71 template< bool > struct sp_enable_if_convertible_impl;
72 
73 template<> struct sp_enable_if_convertible_impl<true>
74 {
75  typedef sp_empty type;
76 };
77 
78 template<> struct sp_enable_if_convertible_impl<false>
79 {
80 };
81 
82 template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_if_convertible_impl< sp_convertible< Y, T >::value >
83 {
84 };
85 
86 } // namespace detail
87 
88 } // namespace boost
89 
90 #endif // !defined( BOOST_SP_NO_SP_CONVERTIBLE )
91 
92 #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED
boost::detail::sp_convertible
Definition: sp_convertible.hpp:41
T
T
Definition: mem_fn_cc.hpp:25
config.hpp
boost::detail::sp_convertible< Y[], T[] >::_vt
_vt
Definition: sp_convertible.hpp:59
boost::detail::sp_convertible::yes
char(& yes)[1]
Definition: sp_convertible.hpp:43
boost::detail::sp_convertible::value
@ value
Definition: sp_convertible.hpp:49
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
boost::detail::sp_enable_if_convertible_impl
Definition: sp_convertible.hpp:71
boost::detail::sp_enable_if_convertible
Definition: sp_convertible.hpp:82
boost::detail::sp_convertible< Y, T[] >::_vt
_vt
Definition: sp_convertible.hpp:54
boost::detail::sp_convertible::no
char(& no)[2]
Definition: sp_convertible.hpp:44
boost::detail::sp_empty
Definition: sp_convertible.hpp:67
boost::detail::sp_convertible::f
static yes f(T *)
boost::detail::sp_convertible::_vt
_vt
Definition: sp_convertible.hpp:49
boost::detail::sp_enable_if_convertible_impl< true >::type
sp_empty type
Definition: sp_convertible.hpp:75
boost::detail::sp_convertible< Y[N], T[] >::_vt
_vt
Definition: sp_convertible.hpp:64


sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:48:40