Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/numeric/interval/doc/policies.htm @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 2.1 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2    "http://www.w3.org/TR/html4/loose.dtd">
3<html>
4<head>
5  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6  <link rel="stylesheet" type="text/css" href="../../../../boost.css">
7  <title>Policies</title>
8</head>
9
10<body lang="en">
11<h1>Policies</h1>
12
13<p>The <code>interval</code> template requires two arguments. The first
14corresponds to the base type chosen for the bounds. And the second defines
15the <a href="rounding.htm">rounding</a> and <a
16href="checking.htm">checking</a> behaviors of the newly constructed class.
17This second argument is not mandatory but may need some customizations. In
18order to ease the manipulations, some helper templates are provided in
19<code>interval/policies.hpp</code>.</p>
20<pre>namespace boost {
21namespace numeric {
22namespace interval_lib {
23
24template&lt;class Rounding, class Checking&gt;
25struct policies {
26  typedef Rounding rounding;
27  typedef Checking checking;
28};
29
30template&lt;class OldInterval, class NewRounding&gt;
31struct change_rounding {
32  typedef ... type;
33};
34
35template&lt;class OldInterval, class NewChecking&gt;
36struct change_checking {
37  typedef ... type;
38};
39
40template&lt;class OldInterval&gt;
41struct unprotect {
42  typedef ... type;
43};
44
45} // namespace interval_lib
46} // namespace numeric
47} // namespace boost</pre>
48
49<p>The <code>policies</code> template should be used whenever the user needs
50to define a policy structure for an <code>interval</code> class.
51<code>change_rounding</code> and <code>change_checking</code> can be used to
52get the type of a new interval by changing one of the policies of an old
53interval; the new type is available thanks to the type definition
54<code>type</code>. Finally, <code>unprotect</code> looks like
55<code>change_rounding</code> and directly changes the rounding of an interval
56to its unprotected version (a better explanation is available <a
57href="rounding.htm#perfexp">here</a>).</p>
58<hr>
59
60<p>Revised: 2003-01-21<br>
61Copyright (c) Guillaume Melquiond, Sylvain Pion, Hervé Brönnimann, 2002.<br>
62Polytechnic University.</p>
63</body>
64</html>
Note: See TracBrowser for help on using the repository browser.