policies.htm 2.8 KB

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