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 9 /*------------------------------------------------------------------------------ 10 itl_rational provides adapter code for boost::rational. 11 ------------------------------------------------------------------------------*/ 12 13 #ifndef BOOST_ICL_RATIONAL_HPP_JOFA_080913 14 #define BOOST_ICL_RATIONAL_HPP_JOFA_080913 15 16 #include <boost/config.hpp> // For BOOST_MSVC and more 17 18 #ifdef BOOST_MSVC 19 #pragma warning(push) 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) 23 #endif 24 25 #include <boost/rational.hpp> 26 27 #ifdef BOOST_MSVC 28 #pragma warning(pop) 29 #endif 30 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> 34 35 namespace boost{namespace icl 36 { 37 template<class Integral> 38 struct is_numeric<boost::rational<Integral> > 39 { 40 typedef is_numeric type; 41 BOOST_STATIC_CONSTANT(bool, value = true); 42 }; 43 44 template<class Integral> 45 struct is_continuous<boost::rational<Integral> > 46 { 47 typedef is_continuous type; 48 BOOST_STATIC_CONSTANT(bool, value = true); 49 }; 50 51 template<class Integral> 52 struct is_discrete<boost::rational<Integral> > 53 { 54 typedef is_discrete type; 55 BOOST_STATIC_CONSTANT(bool, value = false); 56 }; 57 58 template<class Integral> 59 struct has_inverse<boost::rational<Integral> > 60 { 61 typedef has_inverse type; 62 BOOST_STATIC_CONSTANT(bool, value = (boost::is_signed<Integral>::value)); 63 }; 64 65 }} // namespace icl boost 66 67 68 #endif 69 70 71