[12] | 1 | <html> |
---|
| 2 | <head> |
---|
| 3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
---|
| 4 | <title>Class template constrained_value</title> |
---|
| 5 | <link rel="stylesheet" href="boostbook.css" type="text/css"> |
---|
| 6 | <meta name="generator" content="DocBook XSL Stylesheets V1.69.1"> |
---|
| 7 | <link rel="start" href="index.html" title="The Boost C++ Libraries"> |
---|
| 8 | <link rel="up" href="date_time/doxy.html#id2459416" title="Header <boost/date_time/constrained_value.hpp>"> |
---|
| 9 | <link rel="prev" href="c_time.html" title="Struct c_time"> |
---|
| 10 | <link rel="next" href="simple_exception_policy.html" title="Class template simple_exception_policy"> |
---|
| 11 | </head> |
---|
| 12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
---|
| 13 | <table cellpadding="2" width="100%"> |
---|
| 14 | <td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../boost.png"></td> |
---|
| 15 | <td align="center"><a href="../../index.htm">Home</a></td> |
---|
| 16 | <td align="center"><a href="../../libs/libraries.htm">Libraries</a></td> |
---|
| 17 | <td align="center"><a href="../../people/people.htm">People</a></td> |
---|
| 18 | <td align="center"><a href="../../more/faq.htm">FAQ</a></td> |
---|
| 19 | <td align="center"><a href="../../more/index.htm">More</a></td> |
---|
| 20 | </table> |
---|
| 21 | <hr> |
---|
| 22 | <div class="spirit-nav"> |
---|
| 23 | <a accesskey="p" href="c_time.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="date_time/doxy.html#id2459416"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="simple_exception_policy.html"><img src="images/next.png" alt="Next"></a> |
---|
| 24 | </div> |
---|
| 25 | <div class="refentry" lang="en"> |
---|
| 26 | <a name="constrained_value"></a><div class="titlepage"></div> |
---|
| 27 | <div class="refnamediv"> |
---|
| 28 | <h2><span class="refentrytitle">Class template constrained_value</span></h2> |
---|
| 29 | <p>boost::CV::constrained_value — A template to specify a constrained basic value type. </p> |
---|
| 30 | </div> |
---|
| 31 | <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> |
---|
| 32 | <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> value_policies> |
---|
| 33 | <span class="bold"><strong>class</strong></span> constrained_value { |
---|
| 34 | <span class="bold"><strong>public</strong></span>: |
---|
| 35 | <span class="emphasis"><em>// types</em></span> |
---|
| 36 | <span class="bold"><strong>typedef</strong></span> value_policies::value_type value_type; |
---|
| 37 | |
---|
| 38 | <span class="emphasis"><em>// <a href="constrained_value.html#constrained_valueconstruct-copy-destruct">construct/copy/destruct</a></em></span> |
---|
| 39 | <a href="constrained_value.html#id2423509-bb">constrained_value</a>(value_type); |
---|
| 40 | constrained_value& <a href="constrained_value.html#id2454734-bb"><span class="bold"><strong>operator</strong></span>=</a>(value_type); |
---|
| 41 | |
---|
| 42 | <span class="emphasis"><em>// <a href="constrained_value.html#id2508501-bb">public member functions</a></em></span> |
---|
| 43 | <a href="constrained_value.html#id2508505-bb"><span class="bold"><strong>operator</strong></span> value_type</a>() <span class="bold"><strong>const</strong></span>; |
---|
| 44 | |
---|
| 45 | <span class="emphasis"><em>// <a href="constrained_value.html#id2406520-bb">public static functions</a></em></span> |
---|
| 46 | <span class="type">value_type max</span> <a href="constrained_value.html#id2406525-bb">BOOST_PREVENT_MACRO_SUBSTITUTION</a>() ; |
---|
| 47 | <span class="type">value_type min</span> <a href="constrained_value.html#id2457611-bb">BOOST_PREVENT_MACRO_SUBSTITUTION</a>() ; |
---|
| 48 | |
---|
| 49 | <span class="emphasis"><em>// <a href="constrained_value.html#id2458539-bb">private member functions</a></em></span> |
---|
| 50 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="constrained_value.html#id2506761-bb">assign</a>(value_type) ; |
---|
| 51 | };</pre></div> |
---|
| 52 | <div class="refsect1" lang="en"> |
---|
| 53 | <a name="id2607318"></a><h2>Description</h2> |
---|
| 54 | <p>This template provides a quick way to generate an integer type with a constrained range. The type provides for the ability to specify the min, max, and and error handling policy.</p> |
---|
| 55 | <p><span class="bold"><strong>value policies</strong></span> A class that provides the range limits via the min and max functions as well as a function on_error that determines how errors are handled. A common strategy would be to assert or throw and exception. The on_error is passed both the current value and the new value that is in error. </p> |
---|
| 56 | <div class="refsect2" lang="en"> |
---|
| 57 | <a name="id2607338"></a><h3> |
---|
| 58 | <a name="constrained_valueconstruct-copy-destruct"></a><code class="computeroutput">constrained_value</code> construct/copy/destruct</h3> |
---|
| 59 | <div class="orderedlist"><ol type="1"> |
---|
| 60 | <li><pre class="literallayout"><a name="id2423509-bb"></a>constrained_value(value_type value);</pre></li> |
---|
| 61 | <li><pre class="literallayout">constrained_value& <a name="id2454734-bb"></a><span class="bold"><strong>operator</strong></span>=(value_type v);</pre></li> |
---|
| 62 | </ol></div> |
---|
| 63 | </div> |
---|
| 64 | <div class="refsect2" lang="en"> |
---|
| 65 | <a name="id2607393"></a><h3> |
---|
| 66 | <a name="id2508501-bb"></a><code class="computeroutput">constrained_value</code> public member functions</h3> |
---|
| 67 | <div class="orderedlist"><ol type="1"><li><pre class="literallayout"><a name="id2508505-bb"></a><span class="bold"><strong>operator</strong></span> value_type() <span class="bold"><strong>const</strong></span>;</pre></li></ol></div> |
---|
| 68 | </div> |
---|
| 69 | <div class="refsect2" lang="en"> |
---|
| 70 | <a name="id2607436"></a><h3> |
---|
| 71 | <a name="id2406520-bb"></a><code class="computeroutput">constrained_value</code> public static functions</h3> |
---|
| 72 | <div class="orderedlist"><ol type="1"> |
---|
| 73 | <li><pre class="literallayout"><span class="type">value_type max</span> <a name="id2406525-bb"></a>BOOST_PREVENT_MACRO_SUBSTITUTION() ;</pre></li> |
---|
| 74 | <li><pre class="literallayout"><span class="type">value_type min</span> <a name="id2457611-bb"></a>BOOST_PREVENT_MACRO_SUBSTITUTION() ;</pre></li> |
---|
| 75 | </ol></div> |
---|
| 76 | </div> |
---|
| 77 | <div class="refsect2" lang="en"> |
---|
| 78 | <a name="id2607491"></a><h3> |
---|
| 79 | <a name="id2458539-bb"></a><code class="computeroutput">constrained_value</code> private member functions</h3> |
---|
| 80 | <div class="orderedlist"><ol type="1"><li><pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id2506761-bb"></a>assign(value_type value) ;</pre></li></ol></div> |
---|
| 81 | </div> |
---|
| 82 | </div> |
---|
| 83 | </div> |
---|
| 84 | <table width="100%"><tr> |
---|
| 85 | <td align="left"></td> |
---|
| 86 | <td align="right"><small>Copyright © 2001-2005 CrystalClear Software, Inc</small></td> |
---|
| 87 | </tr></table> |
---|
| 88 | <hr> |
---|
| 89 | <div class="spirit-nav"> |
---|
| 90 | <a accesskey="p" href="c_time.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="date_time/doxy.html#id2459416"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="simple_exception_policy.html"><img src="images/next.png" alt="Next"></a> |
---|
| 91 | </div> |
---|
| 92 | </body> |
---|
| 93 | </html> |
---|