mirror of
https://github.com/boostorg/safe_numerics.git
synced 2026-02-22 03:32:24 +00:00
77 lines
2.4 KiB
XML
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<T></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<T></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<T>::value
|
|
== false</code>. For example see
|
|
<code>safe_signed_integer<int></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<T>.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
|
|
<safe_numerics/include/concepts/numeric.hpp> </code></ulink></para>
|
|
</section>
|
|
|
|
<section>
|
|
<title>Models</title>
|
|
|
|
<para><code>int, safe_signed_integer<int>,
|
|
safe_signed_range<int>, etc.</code></para>
|
|
</section>
|
|
</section>
|