Files
safe_numerics/doc/html/exception_policy.html
Robert Ramey 00e39147a4 Resolve problems with documentation
a) missing concepts
b) missing examples
c) rationalized types
2015-06-10 22:46:58 -07:00

153 lines
7.1 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>ExceptionPolicy&lt;EP&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="concepts.html" title="Type Requirements">
<link rel="prev" href="promotion_policy.html" title="PromotionPolicy&lt;PP&gt;">
<link rel="next" href="types.html" title="Types">
</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="promotion_policy.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="concepts.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="types.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.exception_policy"></a>ExceptionPolicy&lt;EP&gt;</h3></div></div></div>
<div class="toc"><dl>
<dt><span class="section"><a href="exception_policy.html#idm354477509136">Description</a></span></dt>
<dt><span class="section"><a href="exception_policy.html#idm354477507712">Notation</a></span></dt>
<dt><span class="section"><a href="exception_policy.html#idm354477501184">Valid Expressions</a></span></dt>
<dt><span class="section"><a href="exception_policy.html#idm354477491232">Header</a></span></dt>
<dt><span class="section"><a href="exception_policy.html#idm354477489200">Models</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="idm354477509136"></a>Description</h4></div></div></div>
<p>The exception policy specifies what is to occur when a safe
operation cannot return a valid arithmetic result. A type is an
ExceptionPolicy if it has functions for handling exceptional events that
occur in the course of safe numeric operations.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="idm354477507712"></a>Notation</h4></div></div></div>
<div class="informaltable"><table class="table">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<tbody>
<tr>
<td align="left"><code class="computeroutput">EP</code></td>
<td align="left">A type that full fills the requirements of an
ExceptionPollicy</td>
</tr>
<tr>
<td align="left">message</td>
<td align="left">A const char * which refers to a text message about the
cause of an exception</td>
</tr>
</tbody>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="idm354477501184"></a>Valid Expressions</h4></div></div></div>
<p>Any operations which result in integers which cannot be represented
as some Numeric type will throw an exception.</p>
<div class="informaltable"><table class="table">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">Expression</th>
<th align="left">Return Value</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><code class="computeroutput">EP::overflow_error(const char *
message)</code></td>
<td align="left">void</td>
</tr>
<tr>
<td align="left"><code class="computeroutput">EP::underflow_error(const char *
message)</code></td>
<td align="left">void</td>
</tr>
<tr>
<td align="left"><code class="computeroutput">EP::range_error(const char *
message)</code></td>
<td align="left">void</td>
</tr>
</tbody>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="idm354477491232"></a>Header</h4></div></div></div>
<p><a href="../../include/concept/exception_policy.hpp" target="_top"><code class="computeroutput">#include
&lt;safe_numerics/include/concepts/exception_policy.hpp&gt;
</code></a></p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="idm354477489200"></a>Models</h4></div></div></div>
<p>The library header <a href="../../include/exception_policy.hpp" target="_top"><code class="computeroutput">#include
&lt;safe_numerics/include/exception_policy.hpp&gt; </code></a>contains
a number of pre-made exception policies:</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p><a name="safe_numerics.exception_policy.models.thow_exception"></a><code class="computeroutput">boost::numeric::throw_exception</code></p>
<p>If an exceptional condition is detected at runtime throw the
exception. Safe types use this exception policy as the default if no
other one is specified.</p>
</li>
<li class="listitem">
<p><a name="safe_numerics.exception_policy.models.ignore_exception"></a><code class="computeroutput">boost::numeric::ignore_exception</code></p>
<p>Emulate the normal C/C++ behavior of permitting overflows,
underflows etc.</p>
</li>
<li class="listitem">
<p><a name="safe_numerics.exception_policy.models.no_exception_support"></a><code class="computeroutput">template&lt;void (*F)(const char *), void (*G)(const char
*), void (*H)(const char *)&gt;</code></p>
<p><code class="computeroutput">boost::numeric::no_exception_support</code></p>
<p>If you want to specify specific behavior for particular
exception types, use this policy. The most likely situation is where
you don't have exception support and you want to trap "exceptions" by
calling your own special functions.</p>
</li>
<li class="listitem">
<p><a name="safe_numerics.exception_policy.models.trap_exception"></a><code class="computeroutput">boost::numeric::trap_exception</code></p>
<p>Use this policy to trap at compile time any operation which
would otherwise trap at runtime. Hence expressions such as i/j will
trap at compile time unless j can be guaranteed to not be zero.</p>
</li>
</ul></div>
</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="http://www.boost.org/LICENSE_1_0.txt" target="_top">Subject to Boost
Software License</a></p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="promotion_policy.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="concepts.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="types.html"><img src="images/next.png" alt="Next"></a>
</div>
</body>
</html>