1 | |
2 | // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. |
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 | #ifndef BOOST_TT_IS_INTEGRAL_HPP_INCLUDED |
10 | #define BOOST_TT_IS_INTEGRAL_HPP_INCLUDED |
11 | |
12 | #include <boost/config.hpp> |
13 | #include <boost/type_traits/integral_constant.hpp> |
14 | |
15 | namespace boost { |
16 | |
17 | #if defined( __CODEGEARC__ ) |
18 | template <class T> |
19 | struct is_integral : public integral_constant<bool, __is_integral(T)> {}; |
20 | #else |
21 | |
22 | template <class T> struct is_integral : public false_type {}; |
23 | template <class T> struct is_integral<const T> : public is_integral<T> {}; |
24 | template <class T> struct is_integral<volatile const T> : public is_integral<T>{}; |
25 | template <class T> struct is_integral<volatile T> : public is_integral<T>{}; |
26 | |
27 | //* is a type T an [cv-qualified-] integral type described in the standard (3.9.1p3) |
28 | // as an extension we include long long, as this is likely to be added to the |
29 | // standard at a later date |
30 | template<> struct is_integral<unsigned char> : public true_type {}; |
31 | template<> struct is_integral<unsigned short> : public true_type{}; |
32 | template<> struct is_integral<unsigned int> : public true_type{}; |
33 | template<> struct is_integral<unsigned long> : public true_type{}; |
34 | |
35 | template<> struct is_integral<signed char> : public true_type{}; |
36 | template<> struct is_integral<short> : public true_type{}; |
37 | template<> struct is_integral<int> : public true_type{}; |
38 | template<> struct is_integral<long> : public true_type{}; |
39 | |
40 | template<> struct is_integral<char> : public true_type{}; |
41 | template<> struct is_integral<bool> : public true_type{}; |
42 | |
43 | #ifndef BOOST_NO_INTRINSIC_WCHAR_T |
44 | // If the following line fails to compile and you're using the Intel |
45 | // compiler, see http://lists.boost.org/MailArchives/boost-users/msg06567.php, |
46 | // and define BOOST_NO_INTRINSIC_WCHAR_T on the command line. |
47 | template<> struct is_integral<wchar_t> : public true_type{}; |
48 | #endif |
49 | |
50 | // Same set of integral types as in boost/type_traits/integral_promotion.hpp. |
51 | // Please, keep in sync. -- Alexander Nasonov |
52 | #if (defined(BOOST_INTEL_CXX_VERSION) && defined(_MSC_VER) && (BOOST_INTEL_CXX_VERSION <= 600)) \ |
53 | || (defined(__BORLANDC__) && (__BORLANDC__ == 0x600) && (_MSC_VER < 1300)) |
54 | template<> struct is_integral<unsigned __int8> : public true_type{}; |
55 | template<> struct is_integral<unsigned __int16> : public true_type{}; |
56 | template<> struct is_integral<unsigned __int32> : public true_type{}; |
57 | template<> struct is_integral<__int8> : public true_type{}; |
58 | template<> struct is_integral<__int16> : public true_type{}; |
59 | template<> struct is_integral<__int32> : public true_type{}; |
60 | #ifdef __BORLANDC__ |
61 | template<> struct is_integral<unsigned __int64> : public true_type{}; |
62 | template<> struct is_integral<__int64> : public true_type{}; |
63 | #endif |
64 | #endif |
65 | |
66 | # if defined(BOOST_HAS_LONG_LONG) |
67 | template<> struct is_integral< ::boost::ulong_long_type> : public true_type{}; |
68 | template<> struct is_integral< ::boost::long_long_type> : public true_type{}; |
69 | #elif defined(BOOST_HAS_MS_INT64) |
70 | template<> struct is_integral<unsigned __int64> : public true_type{}; |
71 | template<> struct is_integral<__int64> : public true_type{}; |
72 | #endif |
73 | |
74 | #ifdef BOOST_HAS_INT128 |
75 | template<> struct is_integral<boost::int128_type> : public true_type{}; |
76 | template<> struct is_integral<boost::uint128_type> : public true_type{}; |
77 | #endif |
78 | #ifndef BOOST_NO_CXX11_CHAR16_T |
79 | template<> struct is_integral<char16_t> : public true_type{}; |
80 | #endif |
81 | #ifndef BOOST_NO_CXX11_CHAR32_T |
82 | template<> struct is_integral<char32_t> : public true_type{}; |
83 | #endif |
84 | |
85 | #endif // non-CodeGear implementation |
86 | |
87 | } // namespace boost |
88 | |
89 | #endif // BOOST_TT_IS_INTEGRAL_HPP_INCLUDED |
90 | |