]> git.lyx.org Git - lyx.git/blob - boost/boost/type_traits/is_class.hpp
complie fix
[lyx.git] / boost / boost / type_traits / is_class.hpp
1 //  (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
2 //  Hinnant & John Maddock 2000-2002.  Permission to copy, use,
3 //  modify, sell and distribute this software is granted provided this
4 //  copyright notice appears in all copies. This software is provided
5 //  "as is" without express or implied warranty, and with no claim as
6 //  to its suitability for any purpose.
7 //
8 //  See http://www.boost.org for most recent version including documentation.
9
10 #ifndef BOOST_TT_IS_CLASS_HPP_INCLUDED
11 #define BOOST_TT_IS_CLASS_HPP_INCLUDED
12
13 #include "boost/type_traits/config.hpp"
14
15 #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
16 #   include "boost/type_traits/detail/yes_no_type.hpp"
17 #else
18 #   include "boost/type_traits/is_union.hpp"
19 #   include "boost/type_traits/is_scalar.hpp"
20 #   include "boost/type_traits/is_array.hpp"
21 #   include "boost/type_traits/is_reference.hpp"
22 #   include "boost/type_traits/is_void.hpp"
23 #   include "boost/type_traits/is_function.hpp"
24 #   include "boost/type_traits/detail/ice_and.hpp"
25 #   include "boost/type_traits/detail/ice_not.hpp"
26 #endif
27
28 // should be the last #include
29 #include "boost/type_traits/detail/bool_trait_def.hpp"
30
31 namespace boost {
32
33 namespace detail {
34
35 #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
36
37 // This is actually the conforming implementation which works with
38 // abstract classes.  However, enough compilers have trouble with
39 // it that most will use the one in
40 // boost/type_traits/object_traits.hpp. This implementation
41 // actually works with VC7.0, but other interactions seem to fail
42 // when we use it.
43
44 // is_class<> metafunction due to Paul Mensonides
45 // (leavings@attbi.com). For more details:
46 // http://groups.google.com/groups?hl=en&selm=000001c1cc83%24e154d5e0%247772e50c%40c161550a&rnum=1
47
48 template <typename T>
49 struct is_class_impl
50 {
51     template <class U> static ::boost::type_traits::yes_type is_class_tester(void(U::*)(void));
52     template <class U> static ::boost::type_traits::no_type is_class_tester(...);
53
54     BOOST_STATIC_CONSTANT(bool, value = 
55         sizeof(is_class_tester<T>(0)) == sizeof(::boost::type_traits::yes_type)
56         );
57 };
58
59 #else
60
61 template <typename T>
62 struct is_class_impl
63 {
64 #   ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
65     BOOST_STATIC_CONSTANT(bool, value =
66     (::boost::type_traits::ice_and<
67         ::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value,
68         ::boost::type_traits::ice_not< ::boost::is_scalar<T>::value >::value,
69         ::boost::type_traits::ice_not< ::boost::is_array<T>::value >::value,
70         ::boost::type_traits::ice_not< ::boost::is_reference<T>::value>::value,
71         ::boost::type_traits::ice_not< ::boost::is_void<T>::value >::value,
72         ::boost::type_traits::ice_not< ::boost::is_function<T>::value >::value
73         >::value));
74 #   else
75     BOOST_STATIC_CONSTANT(bool, value =
76     (::boost::type_traits::ice_and<
77         ::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value,
78         ::boost::type_traits::ice_not< ::boost::is_scalar<T>::value >::value,
79         ::boost::type_traits::ice_not< ::boost::is_array<T>::value >::value,
80         ::boost::type_traits::ice_not< ::boost::is_reference<T>::value>::value,
81         ::boost::type_traits::ice_not< ::boost::is_void<T>::value >::value
82         >::value));
83 #   endif
84 };
85
86 # endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
87
88 } // namespace detail
89
90 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_class,T,::boost::detail::is_class_impl<T>::value)
91
92 } // namespace boost
93
94 #include "boost/type_traits/detail/bool_trait_undef.hpp"
95
96 #endif // BOOST_TT_IS_CLASS_HPP_INCLUDED