Files
safe_numerics/doc/boostbook/throw_exception.xml
Robert Ramey 63dd89210e Enabled Boost Book syntax highlighting
improved TOC and chunking.  This is complicated by the fact we that we desire different depths.
put copies of boost logo in subdirectories
2016-02-07 14:38:06 -08:00

49 lines
1.5 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//Boost//DTD BoostBook XML V1.1//EN"
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
<section id="safe_numerics.exception_policies.throw_exception">
<title>throw_exception</title>
<section id="safenumerics.throw_exception">
<title>Description</title>
<para>This exception policy throws a an exception derived from
<code>std::exception</code> any time some operation would result in an
incorrect result. This is the default exception handling policy.</para>
</section>
<section>
<title>Model of</title>
<para><link
linkend="safe_numerics.promotion_policy">ExceptionPolicy</link></para>
</section>
<section>
<title>Header</title>
<para><code><ulink url="../../include/exception_policy.hpp"><code>#include
&lt;boost/safe_numerics/exception_policies.hpp&gt;
</code></ulink></code></para>
</section>
<section>
<title>Example of use</title>
<para>This example is somewhat contrived as throw_exception is the default
for safe types. Hence it usually is not necessarily to request it
explicitly.</para>
<programlisting>#include "../../include/safe_integer.hpp"
#include "../../include/exception_policies" // exception policies
#include "../../include/native" // native promotion policy
int main(){
using namespace boost::numeric;
safe&lt;int, native, throw_exception&gt; i;
int j = 0;
i /= j; // throws exception
}</programlisting>
</section>
</section>