Files
safe_numerics/doc/boostbook/trap_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

50 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.trap_exception">
<title>trap_exception</title>
<section>
<title>Description</title>
<para>This exception policy will trap at compile time any operation
<emphasis><emphasis role="bold">COULD</emphasis></emphasis> result in a
runtime exception. It can be used in an environment which can tolerate
neither arithmetic errors nor runtime overhead. Usage of this policy will
almost always require altering one's program to avoid exceptions.</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_policy.hpp&gt;
</code></ulink></code></para>
</section>
<section>
<title>Example of use</title>
<para>The following</para>
<programlisting>#include "../../include/safe_integer.hpp"
#include "../../include/automatic.hpp"
#include "../../include/exception_policies.hpp"
int main(){
using namespace boost::numeric;
safe&lt;char, automatic, trap_exception&gt; x, y;
y = x * x; // compile error here !!!
auto z = x * x; // compile OK
return 0;
}</programlisting>
</section>
</section>