• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2"http://www.w3.org/TR/html4/loose.dtd">
3
4<html>
5<head>
6  <meta http-equiv="Content-Language" content="en-us">
7  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
8  <link rel="stylesheet" type="text/css" href="../../../../boost.css">
9
10  <title>Policies</title>
11</head>
12
13<body lang="en">
14  <h1>Policies</h1>
15
16  <p>The <code>interval</code> template requires two arguments. The first
17  corresponds to the base type chosen for the bounds. And the second defines
18  the <a href="rounding.htm">rounding</a> and <a href=
19  "checking.htm">checking</a> behaviors of the newly constructed class. This
20  second argument is not mandatory but may need some customizations. In order
21  to ease the manipulations, some helper templates are provided in
22  <code>interval/policies.hpp</code>.</p>
23  <pre>
24namespace boost {
25namespace numeric {
26namespace interval_lib {
27
28template&lt;class Rounding, class Checking&gt;
29struct policies {
30  typedef Rounding rounding;
31  typedef Checking checking;
32};
33
34template&lt;class OldInterval, class NewRounding&gt;
35struct change_rounding {
36  typedef ... type;
37};
38
39template&lt;class OldInterval, class NewChecking&gt;
40struct change_checking {
41  typedef ... type;
42};
43
44template&lt;class OldInterval&gt;
45struct unprotect {
46  typedef ... type;
47};
48
49} // namespace interval_lib
50} // namespace numeric
51} // namespace boost
52</pre>
53
54  <p>The <code>policies</code> template should be used whenever the user
55  needs to define a policy structure for an <code>interval</code> class.
56  <code>change_rounding</code> and <code>change_checking</code> can be used
57  to get the type of a new interval by changing one of the policies of an old
58  interval; the new type is available thanks to the type definition
59  <code>type</code>. Finally, <code>unprotect</code> looks like
60  <code>change_rounding</code> and directly changes the rounding of an
61  interval to its unprotected version (a better explanation is available
62  <a href="rounding.htm#perfexp">here</a>).</p>
63  <hr>
64
65  <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
66  "../../../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
67  height="31" width="88"></a></p>
68
69  <p>Revised
70  <!--webbot bot="Timestamp" s-type="EDITED" s-format="%Y-%m-%d" startspan -->2006-12-24<!--webbot bot="Timestamp" endspan i-checksum="12172" --></p>
71
72  <p><i>Copyright &copy; 2002 Guillaume Melquiond, Sylvain Pion, Herv&eacute;
73  Br&ouml;nnimann, Polytechnic University</i></p>
74
75  <p><i>Distributed under the Boost Software License, Version 1.0. (See
76  accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
77  or copy at <a href=
78  "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
79</body>
80</html>
81