]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*-----------------------------------------------------------------------------+ |
2 | Copyright (c) 2008-2009: Joachim Faulhaber | |
3 | +------------------------------------------------------------------------------+ | |
4 | Distributed under the Boost Software License, Version 1.0. | |
5 | (See accompanying file LICENCE.txt or copy at | |
6 | http://www.boost.org/LICENSE_1_0.txt) | |
7 | +-----------------------------------------------------------------------------*/ | |
8 | #ifndef BOOST_ICL_TYPE_TRAITS_IS_DISCRETE_HPP_JOFA_100410 | |
9 | #define BOOST_ICL_TYPE_TRAITS_IS_DISCRETE_HPP_JOFA_100410 | |
10 | ||
11 | #include <string> | |
12 | #include <boost/config.hpp> // For macro BOOST_STATIC_CONSTANT | |
13 | #include <boost/mpl/and.hpp> | |
14 | #include <boost/mpl/not.hpp> | |
15 | ||
16 | #ifdef BOOST_MSVC | |
17 | #pragma warning(push) | |
18 | #pragma warning(disable:4913) // user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used | |
19 | #endif | |
20 | ||
21 | #include <boost/detail/is_incrementable.hpp> | |
22 | ||
23 | #ifdef BOOST_MSVC | |
24 | #pragma warning(pop) | |
25 | #endif | |
26 | ||
27 | #include <boost/type_traits/is_integral.hpp> | |
28 | #include <boost/type_traits/is_floating_point.hpp> | |
29 | #include <boost/icl/type_traits/rep_type_of.hpp> | |
30 | #include <boost/icl/type_traits/is_numeric.hpp> | |
31 | ||
32 | namespace boost{ namespace icl | |
33 | { | |
34 | template <class Type> struct is_discrete | |
35 | { | |
36 | typedef is_discrete type; | |
37 | BOOST_STATIC_CONSTANT(bool, | |
38 | value = | |
39 | (mpl::and_ | |
40 | < | |
41 | boost::detail::is_incrementable<Type> | |
42 | , mpl::or_ | |
43 | < | |
44 | mpl::and_ | |
45 | < | |
46 | mpl::not_<has_rep_type<Type> > | |
47 | , is_non_floating_point<Type> | |
48 | > | |
49 | , mpl::and_ | |
50 | < | |
51 | has_rep_type<Type> | |
52 | , is_discrete<typename rep_type_of<Type>::type> | |
53 | > | |
54 | > | |
55 | >::value | |
56 | ) | |
57 | ); | |
58 | }; | |
59 | ||
60 | }} // namespace boost icl | |
61 | ||
62 | #endif | |
63 | ||
64 |