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

77 lines
2.4 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 Numeric if it has the properties of a number.</para>
<para>More specifically, a type T is Numeric if there exists
specialization of <code>std::numeric_limits&lt;T&gt;</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
T which fulfill this concept for which <code>is_arithmetic&lt;T&gt;::value
== false</code>. For example see
<code>safe_signed_integer&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 defined in <link
linkend="safe_numerics.numeric">Numeric</link> the following expressions
must be valid. Any operations which result in integers which cannot be
represented as some Numeric type will throw an exception.<table>
<title>General</title>
<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>
</table></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_signed_integer&lt;int&gt;,
safe_signed_range&lt;int&gt;, etc.</code></para>
</section>
</section>