1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
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
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #ifndef BOOST_COMPUTE_TYPE_TRAITS_IS_FUNDAMENTAL_HPP
12 #define BOOST_COMPUTE_TYPE_TRAITS_IS_FUNDAMENTAL_HPP
14 #include <boost/compute/types/fundamental.hpp>
19 /// Meta-function returning \c true if \p T is a fundamental (i.e.
24 /// is_fundamental<float>::value == true
25 /// is_fundamental<std::pair<int, float>>::value == false
28 struct is_fundamental : public boost::false_type {};
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 {};
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)
53 #undef BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL
55 } // end compute namespace
56 } // end boost namespace
58 #endif // BOOST_COMPUTE_TYPE_TRAITS_IS_FUNDAMENTAL_HPP