Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:49:07

0001 /* Boost interval/policies.hpp template implementation file
0002  *
0003  * Copyright 2003 Guillaume Melquiond
0004  *
0005  * Distributed under the Boost Software License, Version 1.0.
0006  * (See accompanying file LICENSE_1_0.txt or
0007  * copy at http://www.boost.org/LICENSE_1_0.txt)
0008  */
0009 
0010 #ifndef BOOST_NUMERIC_INTERVAL_POLICIES_HPP
0011 #define BOOST_NUMERIC_INTERVAL_POLICIES_HPP
0012 
0013 #include <boost/numeric/interval/interval.hpp>
0014 
0015 namespace boost {
0016 namespace numeric {
0017 namespace interval_lib {
0018 
0019 /*
0020  * policies class
0021  */
0022 
0023 template<class Rounding, class Checking>
0024 struct policies
0025 {
0026   typedef Rounding rounding;
0027   typedef Checking checking;
0028 };
0029 
0030 /*
0031  * policies switching classes
0032  */
0033 
0034 template<class OldInterval, class NewRounding>
0035 class change_rounding
0036 {
0037   typedef typename OldInterval::base_type T;
0038   typedef typename OldInterval::traits_type p;
0039   typedef typename p::checking checking;
0040 public:
0041   typedef interval<T, policies<NewRounding, checking> > type;
0042 };
0043 
0044 template<class OldInterval, class NewChecking>
0045 class change_checking
0046 {
0047   typedef typename OldInterval::base_type T;
0048   typedef typename OldInterval::traits_type p;
0049   typedef typename p::rounding rounding;
0050 public:
0051   typedef interval<T, policies<rounding, NewChecking> > type;
0052 };
0053 
0054 /*
0055  * Protect / unprotect: control whether the rounding mode is set/reset
0056  * at each operation, rather than once and for all.
0057  */
0058 
0059 template<class OldInterval>
0060 class unprotect
0061 {
0062   typedef typename OldInterval::base_type T;
0063   typedef typename OldInterval::traits_type p;
0064   typedef typename p::rounding r;
0065   typedef typename r::unprotected_rounding newRounding;
0066 public:
0067   typedef typename change_rounding<OldInterval, newRounding>::type type;
0068 };
0069 
0070 } // namespace interval_lib
0071 } // namespace numeric
0072 } // namespace boost
0073 
0074 
0075 #endif // BOOST_NUMERIC_INTERVAL_POLICIES_HPP