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/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>
19 #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
20 # include <boost/type_traits/detail/yes_no_type.hpp>
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>
29 #endif // BOOST_IS_CLASS
35 #ifndef BOOST_IS_CLASS
36 #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
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
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__)
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(...);
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
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(...);
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
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
94 # endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
95 # else // BOOST_IS_CLASS
99 BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_CLASS(T));
101 # endif // BOOST_IS_CLASS
103 } // namespace detail
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>{};
114 #endif // BOOST_TT_IS_CLASS_HPP_INCLUDED