annotate DEPENDENCIES/generic/include/boost/numeric/interval/policies.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /* Boost interval/policies.hpp template implementation file
Chris@16 2 *
Chris@16 3 * Copyright 2003 Guillaume Melquiond
Chris@16 4 *
Chris@16 5 * Distributed under the Boost Software License, Version 1.0.
Chris@16 6 * (See accompanying file LICENSE_1_0.txt or
Chris@16 7 * copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 8 */
Chris@16 9
Chris@16 10 #ifndef BOOST_NUMERIC_INTERVAL_POLICIES_HPP
Chris@16 11 #define BOOST_NUMERIC_INTERVAL_POLICIES_HPP
Chris@16 12
Chris@16 13 #include <boost/numeric/interval/interval.hpp>
Chris@16 14
Chris@16 15 namespace boost {
Chris@16 16 namespace numeric {
Chris@16 17 namespace interval_lib {
Chris@16 18
Chris@16 19 /*
Chris@16 20 * policies class
Chris@16 21 */
Chris@16 22
Chris@16 23 template<class Rounding, class Checking>
Chris@16 24 struct policies
Chris@16 25 {
Chris@16 26 typedef Rounding rounding;
Chris@16 27 typedef Checking checking;
Chris@16 28 };
Chris@16 29
Chris@16 30 /*
Chris@16 31 * policies switching classes
Chris@16 32 */
Chris@16 33
Chris@16 34 template<class OldInterval, class NewRounding>
Chris@16 35 class change_rounding
Chris@16 36 {
Chris@16 37 typedef typename OldInterval::base_type T;
Chris@16 38 typedef typename OldInterval::traits_type p;
Chris@16 39 typedef typename p::checking checking;
Chris@16 40 public:
Chris@16 41 typedef interval<T, policies<NewRounding, checking> > type;
Chris@16 42 };
Chris@16 43
Chris@16 44 template<class OldInterval, class NewChecking>
Chris@16 45 class change_checking
Chris@16 46 {
Chris@16 47 typedef typename OldInterval::base_type T;
Chris@16 48 typedef typename OldInterval::traits_type p;
Chris@16 49 typedef typename p::rounding rounding;
Chris@16 50 public:
Chris@16 51 typedef interval<T, policies<rounding, NewChecking> > type;
Chris@16 52 };
Chris@16 53
Chris@16 54 /*
Chris@16 55 * Protect / unprotect: control whether the rounding mode is set/reset
Chris@16 56 * at each operation, rather than once and for all.
Chris@16 57 */
Chris@16 58
Chris@16 59 template<class OldInterval>
Chris@16 60 class unprotect
Chris@16 61 {
Chris@16 62 typedef typename OldInterval::base_type T;
Chris@16 63 typedef typename OldInterval::traits_type p;
Chris@16 64 typedef typename p::rounding r;
Chris@16 65 typedef typename r::unprotected_rounding newRounding;
Chris@16 66 public:
Chris@16 67 typedef typename change_rounding<OldInterval, newRounding>::type type;
Chris@16 68 };
Chris@16 69
Chris@16 70 } // namespace interval_lib
Chris@16 71 } // namespace numeric
Chris@16 72 } // namespace boost
Chris@16 73
Chris@16 74
Chris@16 75 #endif // BOOST_NUMERIC_INTERVAL_POLICIES_HPP