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).
7 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
10 #ifndef BOOST_TT_IS_CLASS_HPP_INCLUDED
11 #define BOOST_TT_IS_CLASS_HPP_INCLUDED
13 #include <boost/type_traits/config.hpp>
14 # include <boost/type_traits/is_union.hpp>
15 # include <boost/type_traits/detail/ice_and.hpp>
16 # include <boost/type_traits/detail/ice_not.hpp>
18 #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
19 # include <boost/type_traits/detail/yes_no_type.hpp>
21 # include <boost/type_traits/is_scalar.hpp>
22 # include <boost/type_traits/is_array.hpp>
23 # include <boost/type_traits/is_reference.hpp>
24 # include <boost/type_traits/is_void.hpp>
25 # include <boost/type_traits/is_function.hpp>
28 #ifdef __EDG_VERSION__
29 # include <boost/type_traits/remove_cv.hpp>
32 // should be the last #include
33 #include <boost/type_traits/detail/bool_trait_def.hpp>
39 #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
41 // This is actually the conforming implementation which works with
42 // abstract classes. However, enough compilers have trouble with
43 // it that most will use the one in
44 // boost/type_traits/object_traits.hpp. This implementation
45 // actually works with VC7.0, but other interactions seem to fail
48 // is_class<> metafunction due to Paul Mensonides
49 // (leavings@attbi.com). For more details:
50 // http://groups.google.com/groups?hl=en&selm=000001c1cc83%24e154d5e0%247772e50c%40c161550a&rnum=1
51 #if defined(__GNUC__) && !defined(__EDG_VERSION__)
53 template <class U> ::boost::type_traits::yes_type is_class_tester(void(U::*)(void));
54 template <class U> ::boost::type_traits::no_type is_class_tester(...);
60 BOOST_STATIC_CONSTANT(bool, value =
61 (::boost::type_traits::ice_and<
62 sizeof(is_class_tester<T>(0)) == sizeof(::boost::type_traits::yes_type),
63 ::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value
73 template <class U> static ::boost::type_traits::yes_type is_class_tester(void(U::*)(void));
74 template <class U> static ::boost::type_traits::no_type is_class_tester(...);
76 BOOST_STATIC_CONSTANT(bool, value =
77 (::boost::type_traits::ice_and<
78 sizeof(is_class_tester<T>(0)) == sizeof(::boost::type_traits::yes_type),
79 ::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value
91 # ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
92 BOOST_STATIC_CONSTANT(bool, value =
93 (::boost::type_traits::ice_and<
94 ::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value,
95 ::boost::type_traits::ice_not< ::boost::is_scalar<T>::value >::value,
96 ::boost::type_traits::ice_not< ::boost::is_array<T>::value >::value,
97 ::boost::type_traits::ice_not< ::boost::is_reference<T>::value>::value,
98 ::boost::type_traits::ice_not< ::boost::is_void<T>::value >::value,
99 ::boost::type_traits::ice_not< ::boost::is_function<T>::value >::value
102 BOOST_STATIC_CONSTANT(bool, value =
103 (::boost::type_traits::ice_and<
104 ::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value,
105 ::boost::type_traits::ice_not< ::boost::is_scalar<T>::value >::value,
106 ::boost::type_traits::ice_not< ::boost::is_array<T>::value >::value,
107 ::boost::type_traits::ice_not< ::boost::is_reference<T>::value>::value,
108 ::boost::type_traits::ice_not< ::boost::is_void<T>::value >::value
113 # endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
115 } // namespace detail
117 # ifdef __EDG_VERSION__
118 BOOST_TT_AUX_BOOL_TRAIT_DEF1(
119 is_class,T, detail::is_class_impl<typename boost::remove_cv<T>::type>::value)
121 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_class,T,::boost::detail::is_class_impl<T>::value)
126 #include <boost/type_traits/detail/bool_trait_undef.hpp>
128 #endif // BOOST_TT_IS_CLASS_HPP_INCLUDED