Files
safe_numerics/doc/html/safe_unsigned_range.html
2013-11-04 11:44:56 -08:00

117 lines
5.3 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>safe_unsigned_range&lt;MIN, MAX&gt;</title>
<link rel="stylesheet" href="boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Safe Numerics">
<link rel="up" href="types.html" title="Types">
<link rel="prev" href="types.html" title="Types">
<link rel="next" href="safe_signed_range.html" title="safe_signed_range&lt;MIN, MAX&gt;">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="pre-boost" width="30%" height="30%" src="pre-boost.jpg"></td>
<td align="center"><a href="../../index.html">Home</a></td>
<td align="center"><a href="http://www.boost.org/doc/libs">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="types.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="types.html"><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="safe_signed_range.html"><img src="images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="safe_numerics.safe_unsigned_range"></a>safe_unsigned_range&lt;MIN, MAX&gt;</h3></div></div></div>
<div class="toc"><dl>
<dt><span class="section"><a href="safe_unsigned_range.html#id753452">Description</a></span></dt>
<dt><span class="section"><a href="safe_unsigned_range.html#id753471">Template Parameters</a></span></dt>
<dt><span class="section"><a href="safe_unsigned_range.html#id753587">Model of</a></span></dt>
<dt><span class="section"><a href="safe_unsigned_range.html#id753704">Header</a></span></dt>
<dt><span class="section"><a href="safe_unsigned_range.html#id753724">Example of use</a></span></dt>
<dt><span class="section"><a href="safe_unsigned_range.html#id753746">See Also</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="id753452"></a>Description</h4></div></div></div>
<p>This type holds a integer in the range [MIN, MAX]. It will throw a
<code class="computeroutput">std::out_of_range</code> exception for any operation which would
result in assigning an integer value outside of this range.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="id753471"></a>Template Parameters</h4></div></div></div>
<div class="informaltable"><table class="table">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">Parameter</th>
<th align="left">Requirements</th>
<th align="left">Description</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><code class="computeroutput">MIN</code></td>
<td align="left">must be a positive integer literal</td>
<td align="left">The minimum integer value that this type may hold</td>
</tr>
<tr>
<td align="left"><code class="computeroutput">MAX</code></td>
<td align="left">must be a positive integer literal</td>
<td align="left">The maximum integer value that this type may hold</td>
</tr>
<tr>
<td align="left"><code class="computeroutput"></code></td>
<td align="left">MIN &lt; MAX</td>
<td align="left">&#160;</td>
</tr>
</tbody>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="id753587"></a>Model of</h4></div></div></div>
<p><a class="link" href="numeric.html" title="Numeric&lt;T&gt;">Numeric</a></p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="id753704"></a>Header</h4></div></div></div>
<p><code class="filename"><a href="../../include/safe_range.hpp" target="_top">#include
&lt;safe/numeric/safe_range.hpp&gt;</a></code></p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="id753724"></a>Example of use</h4></div></div></div>
<pre class="programlisting">#include &lt;safe/numeric/safe_range.hpp&gt;
void f(){
boost::numeric::safe_unsigned_range&lt;7, 24&gt; i;
i = 0; // throws out_of_range exception
i = 9; // ok
i *= 9; // throws out_of_range exception
i = -1; // throws out_of_range exception
}</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="id753746"></a>See Also</h4></div></div></div>
<p><code class="computeroutput">std::out_of_range</code></p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2012 Robert Ramey<p><a href="???" target="_top">Subject to Boost Software License</a></p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="types.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="types.html"><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="safe_signed_range.html"><img src="images/next.png" alt="Next"></a>
</div>
</body>
</html>