Files
safe_numerics/doc/boostbook/integer_concept.xml
Robert Ramey bce3a5536e intermediate version
passes all tests
adds documentation of library internals
implements trap_exception for compile time guarantee for program correctness
still needs update to support the above for operations in addition to + and -
2015-12-15 10:21:08 -08:00

77 lines
2.3 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.integer">
<title>Integer&lt;T&gt;</title>
<section>
<title>Description</title>
<para>A type is fulls the requirements of an Integer if it has the
properties of a integer.</para>
<para>More specifically, a type T is Integer if there exists
specialization of <code>std::numeric_limits&lt;T&gt; for which
std::numeric_limits&lt;T&gt;:: is_integer</code> is equal to
<code>true</code>. See the documentation for standard library class
numeric_limits. The standard library includes such specializations for all
the primitive numeric types. Note that this concept is distinct from the
C++ standard library type traits <code>is_integral</code> and
<code>is_arithmetic</code>. These latter fulfill the requirement of the
concept Numeric. But there are types which fulfill this concept for which
<code>is_arithmetic&lt;T&gt;::value == false</code>. For example see
<code>safe&lt;int&gt;</code>.</para>
</section>
<section>
<title>Refinement of</title>
<para><link linkend="safe_numerics.numeric">Numeric</link></para>
</section>
<section>
<title>Valid Expressions</title>
<para>In addition to the expressions defined in <link
linkend="safe_numerics.numeric">Numeric</link> the following expressions
must be valid. <informaltable>
<tgroup cols="2">
<colspec align="left"/>
<colspec align="left"/>
<thead>
<row>
<entry align="left">Expression</entry>
<entry>Return Value</entry>
</row>
</thead>
<tbody>
<row>
<entry><code>std::numeric_limits&lt;T&gt;
is_integer</code></entry>
<entry>true</entry>
</row>
</tbody>
</tgroup>
</informaltable></para>
</section>
<section>
<title>Header</title>
<para><ulink url="../../include/concept/numeric.hpp"><code>#include
&lt;safe_numerics/include/concepts/numeric.hpp&gt; </code></ulink></para>
</section>
<section>
<title>Models</title>
<para><code>int, safe&lt;int&gt;, safe_unsigned_range&lt;0, 11&gt;,
etc.</code></para>
</section>
</section>