Chris@16: /* Boost interval/policies.hpp template implementation file Chris@16: * Chris@16: * Copyright 2003 Guillaume Melquiond Chris@16: * Chris@16: * Distributed under the Boost Software License, Version 1.0. Chris@16: * (See accompanying file LICENSE_1_0.txt or Chris@16: * copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_NUMERIC_INTERVAL_POLICIES_HPP Chris@16: #define BOOST_NUMERIC_INTERVAL_POLICIES_HPP Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: namespace numeric { Chris@16: namespace interval_lib { Chris@16: Chris@16: /* Chris@16: * policies class Chris@16: */ Chris@16: Chris@16: template Chris@16: struct policies Chris@16: { Chris@16: typedef Rounding rounding; Chris@16: typedef Checking checking; Chris@16: }; Chris@16: Chris@16: /* Chris@16: * policies switching classes Chris@16: */ Chris@16: Chris@16: template Chris@16: class change_rounding Chris@16: { Chris@16: typedef typename OldInterval::base_type T; Chris@16: typedef typename OldInterval::traits_type p; Chris@16: typedef typename p::checking checking; Chris@16: public: Chris@16: typedef interval > type; Chris@16: }; Chris@16: Chris@16: template Chris@16: class change_checking Chris@16: { Chris@16: typedef typename OldInterval::base_type T; Chris@16: typedef typename OldInterval::traits_type p; Chris@16: typedef typename p::rounding rounding; Chris@16: public: Chris@16: typedef interval > type; Chris@16: }; Chris@16: Chris@16: /* Chris@16: * Protect / unprotect: control whether the rounding mode is set/reset Chris@16: * at each operation, rather than once and for all. Chris@16: */ Chris@16: Chris@16: template Chris@16: class unprotect Chris@16: { Chris@16: typedef typename OldInterval::base_type T; Chris@16: typedef typename OldInterval::traits_type p; Chris@16: typedef typename p::rounding r; Chris@16: typedef typename r::unprotected_rounding newRounding; Chris@16: public: Chris@16: typedef typename change_rounding::type type; Chris@16: }; Chris@16: Chris@16: } // namespace interval_lib Chris@16: } // namespace numeric Chris@16: } // namespace boost Chris@16: Chris@16: Chris@16: #endif // BOOST_NUMERIC_INTERVAL_POLICIES_HPP