Chris@16
|
1 /*-----------------------------------------------------------------------------+
|
Chris@16
|
2 Copyright (c) 2008-2009: Joachim Faulhaber
|
Chris@16
|
3 +------------------------------------------------------------------------------+
|
Chris@16
|
4 Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
5 (See accompanying file LICENCE.txt or copy at
|
Chris@16
|
6 http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
7 +-----------------------------------------------------------------------------*/
|
Chris@16
|
8
|
Chris@16
|
9 /*------------------------------------------------------------------------------
|
Chris@16
|
10 itl_rational provides adapter code for boost::rational.
|
Chris@16
|
11 ------------------------------------------------------------------------------*/
|
Chris@16
|
12
|
Chris@16
|
13 #ifndef BOOST_ICL_RATIONAL_HPP_JOFA_080913
|
Chris@16
|
14 #define BOOST_ICL_RATIONAL_HPP_JOFA_080913
|
Chris@16
|
15
|
Chris@16
|
16 #include <boost/config.hpp> // For BOOST_MSVC and more
|
Chris@16
|
17
|
Chris@16
|
18 #ifdef BOOST_MSVC
|
Chris@16
|
19 #pragma warning(push)
|
Chris@16
|
20 #pragma warning(disable:4127) // conditional expression is constant
|
Chris@16
|
21 #pragma warning(disable:4512) // 'boost::detail::resetter' : assignment operator could not be generated
|
Chris@16
|
22 #pragma warning(disable:4800) // 'unsigned int' : forcing value to bool 'true' or 'false' (performance warning)
|
Chris@16
|
23 #endif
|
Chris@16
|
24
|
Chris@16
|
25 #include <boost/rational.hpp>
|
Chris@16
|
26
|
Chris@16
|
27 #ifdef BOOST_MSVC
|
Chris@16
|
28 #pragma warning(pop)
|
Chris@16
|
29 #endif
|
Chris@16
|
30
|
Chris@16
|
31 #include <boost/icl/type_traits/is_continuous.hpp>
|
Chris@16
|
32 #include <boost/icl/type_traits/has_inverse.hpp>
|
Chris@16
|
33 #include <boost/icl/type_traits/is_numeric.hpp>
|
Chris@16
|
34
|
Chris@16
|
35 namespace boost{namespace icl
|
Chris@16
|
36 {
|
Chris@16
|
37 template<class Integral>
|
Chris@16
|
38 struct is_numeric<boost::rational<Integral> >
|
Chris@16
|
39 {
|
Chris@16
|
40 typedef is_numeric type;
|
Chris@16
|
41 BOOST_STATIC_CONSTANT(bool, value = true);
|
Chris@16
|
42 };
|
Chris@16
|
43
|
Chris@16
|
44 template<class Integral>
|
Chris@16
|
45 struct is_continuous<boost::rational<Integral> >
|
Chris@16
|
46 {
|
Chris@16
|
47 typedef is_continuous type;
|
Chris@16
|
48 BOOST_STATIC_CONSTANT(bool, value = true);
|
Chris@16
|
49 };
|
Chris@16
|
50
|
Chris@16
|
51 template<class Integral>
|
Chris@16
|
52 struct is_discrete<boost::rational<Integral> >
|
Chris@16
|
53 {
|
Chris@16
|
54 typedef is_discrete type;
|
Chris@16
|
55 BOOST_STATIC_CONSTANT(bool, value = false);
|
Chris@16
|
56 };
|
Chris@16
|
57
|
Chris@16
|
58 template<class Integral>
|
Chris@16
|
59 struct has_inverse<boost::rational<Integral> >
|
Chris@16
|
60 {
|
Chris@16
|
61 typedef has_inverse type;
|
Chris@16
|
62 BOOST_STATIC_CONSTANT(bool, value = (boost::is_signed<Integral>::value));
|
Chris@16
|
63 };
|
Chris@16
|
64
|
Chris@16
|
65 }} // namespace icl boost
|
Chris@16
|
66
|
Chris@16
|
67
|
Chris@16
|
68 #endif
|
Chris@16
|
69
|
Chris@16
|
70
|