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 +-----------------------------------------------------------------------------*/
9 /*------------------------------------------------------------------------------
10 itl_rational provides adapter code for boost::rational.
11 ------------------------------------------------------------------------------*/
13 #ifndef BOOST_ICL_RATIONAL_HPP_JOFA_080913
14 #define BOOST_ICL_RATIONAL_HPP_JOFA_080913
16 #include <boost/config.hpp> // For BOOST_MSVC and more
20 #pragma warning(disable:4127) // conditional expression is constant
21 #pragma warning(disable:4512) // 'boost::detail::resetter' : assignment operator could not be generated
22 #pragma warning(disable:4800) // 'unsigned int' : forcing value to bool 'true' or 'false' (performance warning)
25 #include <boost/rational.hpp>
31 #include <boost/icl/type_traits/is_continuous.hpp>
32 #include <boost/icl/type_traits/has_inverse.hpp>
33 #include <boost/icl/type_traits/is_numeric.hpp>
35 namespace boost{namespace icl
37 template<class Integral>
38 struct is_numeric<boost::rational<Integral> >
40 typedef is_numeric type;
41 BOOST_STATIC_CONSTANT(bool, value = true);
44 template<class Integral>
45 struct is_continuous<boost::rational<Integral> >
47 typedef is_continuous type;
48 BOOST_STATIC_CONSTANT(bool, value = true);
51 template<class Integral>
52 struct is_discrete<boost::rational<Integral> >
54 typedef is_discrete type;
55 BOOST_STATIC_CONSTANT(bool, value = false);
58 template<class Integral>
59 struct has_inverse<boost::rational<Integral> >
61 typedef has_inverse type;
62 BOOST_STATIC_CONSTANT(bool, value = (boost::is_signed<Integral>::value));
65 }} // namespace icl boost