...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The interval
template requires two arguments. The first
corresponds to the base type chosen for the bounds. And the second defines
the rounding and checking behaviors of the newly constructed class. This
second argument is not mandatory but may need some customizations. In order
to ease the manipulations, some helper templates are provided in
interval/policies.hpp
.
namespace boost { namespace numeric { namespace interval_lib { template<class Rounding, class Checking> struct policies { typedef Rounding rounding; typedef Checking checking; }; template<class OldInterval, class NewRounding> struct change_rounding { typedef ... type; }; template<class OldInterval, class NewChecking> struct change_checking { typedef ... type; }; template<class OldInterval> struct unprotect { typedef ... type; }; } // namespace interval_lib } // namespace numeric } // namespace boost
The policies
template should be used whenever the user
needs to define a policy structure for an interval
class.
change_rounding
and change_checking
can be used
to get the type of a new interval by changing one of the policies of an old
interval; the new type is available thanks to the type definition
type
. Finally, unprotect
looks like
change_rounding
and directly changes the rounding of an
interval to its unprotected version (a better explanation is available
here).
Revised 2006-12-24
Copyright © 2002 Guillaume Melquiond, Sylvain Pion, Hervé Brönnimann, Polytechnic University
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)