]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/type_traits/is_class.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / type_traits / is_class.hpp
1 // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
2 // Hinnant & John Maddock 2000-2003.
3 // Use, modification and distribution are subject to the Boost Software License,
4 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt).
6 //
7 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
8
9
10 #ifndef BOOST_TT_IS_CLASS_HPP_INCLUDED
11 #define BOOST_TT_IS_CLASS_HPP_INCLUDED
12
13 #include <boost/type_traits/detail/config.hpp>
14 #include <boost/type_traits/intrinsics.hpp>
15 #include <boost/type_traits/integral_constant.hpp>
16 #ifndef BOOST_IS_CLASS
17 # include <boost/type_traits/is_union.hpp>
18
19 #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
20 # include <boost/type_traits/detail/yes_no_type.hpp>
21 #else
22 # include <boost/type_traits/is_scalar.hpp>
23 # include <boost/type_traits/is_array.hpp>
24 # include <boost/type_traits/is_reference.hpp>
25 # include <boost/type_traits/is_void.hpp>
26 # include <boost/type_traits/is_function.hpp>
27 #endif
28
29 #endif // BOOST_IS_CLASS
30
31 namespace boost {
32
33 namespace detail {
34
35 #ifndef BOOST_IS_CLASS
36 #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
37
38 // This is actually the conforming implementation which works with
39 // abstract classes. However, enough compilers have trouble with
40 // it that most will use the one in
41 // boost/type_traits/object_traits.hpp. This implementation
42 // actually works with VC7.0, but other interactions seem to fail
43 // when we use it.
44
45 // is_class<> metafunction due to Paul Mensonides
46 // (leavings@attbi.com). For more details:
47 // http://groups.google.com/groups?hl=en&selm=000001c1cc83%24e154d5e0%247772e50c%40c161550a&rnum=1
48 #if defined(__GNUC__) && !defined(__EDG_VERSION__)
49
50 template <class U> ::boost::type_traits::yes_type is_class_tester(void(U::*)(void));
51 template <class U> ::boost::type_traits::no_type is_class_tester(...);
52
53 template <typename T>
54 struct is_class_impl
55 {
56
57 BOOST_STATIC_CONSTANT(bool, value =
58 sizeof(is_class_tester<T>(0)) == sizeof(::boost::type_traits::yes_type)
59 && ! ::boost::is_union<T>::value
60 );
61 };
62
63 #else
64
65 template <typename T>
66 struct is_class_impl
67 {
68 template <class U> static ::boost::type_traits::yes_type is_class_tester(void(U::*)(void));
69 template <class U> static ::boost::type_traits::no_type is_class_tester(...);
70
71 BOOST_STATIC_CONSTANT(bool, value =
72 sizeof(is_class_tester<T>(0)) == sizeof(::boost::type_traits::yes_type)
73 && ! ::boost::is_union<T>::value
74 );
75 };
76
77 #endif
78
79 #else
80
81 template <typename T>
82 struct is_class_impl
83 {
84 BOOST_STATIC_CONSTANT(bool, value =
85 ! ::boost::is_union<T>::value >::value
86 && ! ::boost::is_scalar<T>::value
87 && ! ::boost::is_array<T>::value
88 && ! ::boost::is_reference<T>::value
89 && ! ::boost::is_void<T>::value
90 && ! ::boost::is_function<T>::value
91 );
92 };
93
94 # endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
95 # else // BOOST_IS_CLASS
96 template <typename T>
97 struct is_class_impl
98 {
99 BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_CLASS(T));
100 };
101 # endif // BOOST_IS_CLASS
102
103 } // namespace detail
104
105 template <class T> struct is_class : public integral_constant<bool, ::boost::detail::is_class_impl<T>::value> {};
106 # ifdef __EDG_VERSION__
107 template <class T> struct is_class<const T> : public is_class<T>{};
108 template <class T> struct is_class<const volatile T> : public is_class<T>{};
109 template <class T> struct is_class<volatile T> : public is_class<T>{};
110 # endif
111
112 } // namespace boost
113
114 #endif // BOOST_TT_IS_CLASS_HPP_INCLUDED