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.
8 // See http://www.boost.org 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 // should be the last #include
29 #include "boost/type_traits/detail/bool_trait_def.hpp"
35 #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
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
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
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(...);
54 BOOST_STATIC_CONSTANT(bool, value =
55 (::boost::type_traits::ice_and<
56 sizeof(is_class_tester<T>(0)) == sizeof(::boost::type_traits::yes_type),
57 ::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value
67 # ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
68 BOOST_STATIC_CONSTANT(bool, value =
69 (::boost::type_traits::ice_and<
70 ::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value,
71 ::boost::type_traits::ice_not< ::boost::is_scalar<T>::value >::value,
72 ::boost::type_traits::ice_not< ::boost::is_array<T>::value >::value,
73 ::boost::type_traits::ice_not< ::boost::is_reference<T>::value>::value,
74 ::boost::type_traits::ice_not< ::boost::is_void<T>::value >::value,
75 ::boost::type_traits::ice_not< ::boost::is_function<T>::value >::value
78 BOOST_STATIC_CONSTANT(bool, value =
79 (::boost::type_traits::ice_and<
80 ::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value,
81 ::boost::type_traits::ice_not< ::boost::is_scalar<T>::value >::value,
82 ::boost::type_traits::ice_not< ::boost::is_array<T>::value >::value,
83 ::boost::type_traits::ice_not< ::boost::is_reference<T>::value>::value,
84 ::boost::type_traits::ice_not< ::boost::is_void<T>::value >::value
89 # endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
93 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_class,T,::boost::detail::is_class_impl<T>::value)
97 #include "boost/type_traits/detail/bool_trait_undef.hpp"
99 #endif // BOOST_TT_IS_CLASS_HPP_INCLUDED