mirror of
https://github.com/boostorg/safe_numerics.git
synced 2026-02-12 00:13:20 +00:00
105 lines
5.5 KiB
HTML
105 lines
5.5 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
|
<title>Integer<T></title>
|
|
<link rel="stylesheet" href="boostbook.css" type="text/css">
|
|
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
|
|
<link rel="home" href="index.html" title="Safe Numerics">
|
|
<link rel="up" href="concepts.html" title="Type Requirements">
|
|
<link rel="prev" href="numeric.html" title="Numeric<T>">
|
|
<link rel="next" href="safe_numeric_concept.html" title="SafeNumeric<T>">
|
|
</head>
|
|
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
|
<table cellpadding="2" width="100%"><tr>
|
|
<td valign="top"><img alt="pre-boost" width="30%" height="30%" src="pre-boost.jpg"></td>
|
|
<td align="center"><a href="../../index.html">Home</a></td>
|
|
<td align="center"><a href="http://www.boost.org/doc/libs">Libraries</a></td>
|
|
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
|
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
|
<td align="center"><a href="../../more/index.htm">More</a></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="numeric.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="concepts.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="safe_numeric_concept.html"><img src="images/next.png" alt="Next"></a>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h3 class="title">
|
|
<a name="safe_numerics.integer"></a>Integer<T></h3></div></div></div>
|
|
<div class="toc"><dl>
|
|
<dt><span class="section"><a href="integer.html#idm354477624816">Description</a></span></dt>
|
|
<dt><span class="section"><a href="integer.html#idm354477619648">Refinement of</a></span></dt>
|
|
<dt><span class="section"><a href="integer.html#idm354477618144">Valid Expressions</a></span></dt>
|
|
<dt><span class="section"><a href="integer.html#idm354477610288">Header</a></span></dt>
|
|
<dt><span class="section"><a href="integer.html#idm354477608288">Models</a></span></dt>
|
|
</dl></div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="idm354477624816"></a>Description</h4></div></div></div>
|
|
<p>A type is Numeric if it has the properties of a number.</p>
|
|
<p>More specifically, a type T is Numeric if there exists
|
|
specialization of <code class="computeroutput">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 class="computeroutput">is_integral</code> and <code class="computeroutput">is_arithmetic</code>. These
|
|
latter fulfill the requirement of the concept Numeric. But there are types
|
|
T which fulfill this concept for which <code class="computeroutput">is_arithmetic<T>::value
|
|
== false</code>. For example see
|
|
<code class="computeroutput">safe_signed_integer<int></code>.</p>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="idm354477619648"></a>Refinement of</h4></div></div></div>
|
|
<p><a class="link" href="numeric.html" title="Numeric<T>">Numeric</a></p>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="idm354477618144"></a>Valid Expressions</h4></div></div></div>
|
|
<p>In addition to the expressions defined defined in <a class="link" href="numeric.html" title="Numeric<T>">Numeric</a> the following expressions
|
|
must be valid. Any operations which result in integers which cannot be
|
|
represented as some Numeric type will throw an exception.</p>
|
|
<div class="table">
|
|
<a name="idm354477616400"></a><p class="title"><b>Table 4. General</b></p>
|
|
<div class="table-contents"><table class="table" summary="General">
|
|
<colgroup>
|
|
<col align="left">
|
|
<col align="left">
|
|
</colgroup>
|
|
<thead><tr>
|
|
<th align="left">Expression</th>
|
|
<th align="left">Return Value</th>
|
|
</tr></thead>
|
|
<tbody><tr>
|
|
<td align="left"><code class="computeroutput">std::numeric_limits<T>.is_integer</code></td>
|
|
<td align="left">true</td>
|
|
</tr></tbody>
|
|
</table></div>
|
|
</div>
|
|
<p><br class="table-break"></p>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="idm354477610288"></a>Header</h4></div></div></div>
|
|
<p><a href="../../include/concept/numeric.hpp" target="_top"><code class="computeroutput">#include
|
|
<safe_numerics/include/concepts/numeric.hpp> </code></a></p>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="idm354477608288"></a>Models</h4></div></div></div>
|
|
<p><code class="computeroutput">int, safe_signed_integer<int>,
|
|
safe_signed_range<int>, etc.</code></p>
|
|
</div>
|
|
</div>
|
|
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
|
<td align="left"></td>
|
|
<td align="right"><div class="copyright-footer">Copyright © 2012 Robert Ramey<p><a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">Subject to Boost
|
|
Software License</a></p>
|
|
</div></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="numeric.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="concepts.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="safe_numeric_concept.html"><img src="images/next.png" alt="Next"></a>
|
|
</div>
|
|
</body>
|
|
</html>
|