]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | //---------------------------------------------------------------------------// |
2 | // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com> | |
3 | // | |
4 | // Distributed under the Boost Software License, Version 1.0 | |
5 | // See accompanying file LICENSE_1_0.txt or copy at | |
6 | // http://www.boost.org/LICENSE_1_0.txt | |
7 | // | |
8 | // See http://boostorg.github.com/compute for more information. | |
9 | //---------------------------------------------------------------------------// | |
10 | ||
11 | #ifndef BOOST_COMPUTE_TYPE_TRAITS_IS_FUNDAMENTAL_HPP | |
12 | #define BOOST_COMPUTE_TYPE_TRAITS_IS_FUNDAMENTAL_HPP | |
13 | ||
14 | #include <boost/compute/types/fundamental.hpp> | |
15 | ||
16 | namespace boost { | |
17 | namespace compute { | |
18 | ||
19 | /// Meta-function returning \c true if \p T is a fundamental (i.e. | |
20 | /// built-in) type. | |
21 | /// | |
22 | /// For example, | |
23 | /// \code | |
24 | /// is_fundamental<float>::value == true | |
25 | /// is_fundamental<std::pair<int, float>>::value == false | |
26 | /// \endcode | |
27 | template<class T> | |
28 | struct is_fundamental : public boost::false_type {}; | |
29 | ||
30 | /// \internal_ | |
31 | #define BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(type) \ | |
32 | template<> struct is_fundamental<BOOST_PP_CAT(type, _)> : boost::true_type {}; \ | |
33 | template<> struct is_fundamental<BOOST_PP_CAT(BOOST_PP_CAT(type, 2), _)> : boost::true_type {}; \ | |
34 | template<> struct is_fundamental<BOOST_PP_CAT(BOOST_PP_CAT(type, 4), _)> : boost::true_type {}; \ | |
35 | template<> struct is_fundamental<BOOST_PP_CAT(BOOST_PP_CAT(type, 8), _)> : boost::true_type {}; \ | |
36 | template<> struct is_fundamental<BOOST_PP_CAT(BOOST_PP_CAT(type, 16), _)> : boost::true_type {}; \ | |
37 | template<> struct is_fundamental<BOOST_PP_CAT(cl_, BOOST_PP_CAT(type, 2))> : boost::true_type {}; \ | |
38 | template<> struct is_fundamental<BOOST_PP_CAT(cl_, BOOST_PP_CAT(type, 4))> : boost::true_type {}; \ | |
39 | template<> struct is_fundamental<BOOST_PP_CAT(cl_, BOOST_PP_CAT(type, 8))> : boost::true_type {}; \ | |
40 | template<> struct is_fundamental<BOOST_PP_CAT(cl_, BOOST_PP_CAT(type, 16))> : boost::true_type {}; | |
41 | ||
42 | BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(char) | |
43 | BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(uchar) | |
44 | BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(short) | |
45 | BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(ushort) | |
46 | BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(int) | |
47 | BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(uint) | |
48 | BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(long) | |
49 | BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(ulong) | |
50 | BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(float) | |
51 | BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(double) | |
52 | ||
53 | #undef BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL | |
54 | ||
55 | } // end compute namespace | |
56 | } // end boost namespace | |
57 | ||
58 | #endif // BOOST_COMPUTE_TYPE_TRAITS_IS_FUNDAMENTAL_HPP |