6f63e9d0c6
[SVN r64705]
132 lines
9.3 KiB
HTML
132 lines
9.3 KiB
HTML
<?xml version="1.0" encoding="utf-8" ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="generator" content="Docutils 0.7: http://docutils.sourceforge.net/" />
|
|
<title>The MPL Reference Manual: Integral Constant</title>
|
|
<link rel="stylesheet" href="../style.css" type="text/css" />
|
|
</head>
|
|
<body class="docframe refmanual">
|
|
<table class="header"><tr class="header"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./data-types-concepts.html" class="navigation-link">Prev</a> <a href="./numeric.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group">Back Along</span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./data-types-concepts.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
|
|
<td class="header-group page-location"><a href="../refmanual.html" class="navigation-link">Front Page</a> / <a href="./data-types.html" class="navigation-link">Data Types</a> / <a href="./data-types-concepts.html" class="navigation-link">Concepts</a> / <a href="./integral-constant.html" class="navigation-link">Integral Constant</a></td>
|
|
</tr></table><div class="header-separator"></div>
|
|
<div class="section" id="integral-constant">
|
|
<h1><a class="toc-backref" href="./data-types-concepts.html#id1574">Integral Constant</a></h1>
|
|
<div class="section" id="id1217">
|
|
<h3><a class="subsection-title" href="#description" name="description">Description</a></h3>
|
|
<p>An <a class="reference internal" href="./integral-constant.html">Integral Constant</a> is a holder class for a compile-time value of an
|
|
integral type. Every <a class="reference internal" href="./integral-constant.html">Integral Constant</a> is also a nullary <a class="reference internal" href="./metafunction.html">Metafunction</a>,
|
|
returning itself. An integral constant <em>object</em> is implicitly convertible to the
|
|
corresponding run-time value of the wrapped integral type.</p>
|
|
</div>
|
|
<div class="section" id="id1218">
|
|
<h3><a class="subsection-title" href="#expression-requirements" name="expression-requirements">Expression requirements</a></h3>
|
|
<p>In the following table and subsequent specifications, <tt class="literal"><span class="pre">n</span></tt> is a model of <a class="reference internal" href="./integral-constant.html">Integral Constant</a>.</p>
|
|
<table border="1" class="docutils table">
|
|
<colgroup>
|
|
<col width="35%" />
|
|
<col width="39%" />
|
|
<col width="27%" />
|
|
</colgroup>
|
|
<thead valign="bottom">
|
|
<tr><th class="head">Expression</th>
|
|
<th class="head">Type</th>
|
|
<th class="head">Complexity</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody valign="top">
|
|
<tr><td><tt class="literal"><span class="pre">n::tag</span></tt></td>
|
|
<td><tt class="literal"><span class="pre">integral_c_tag</span></tt></td>
|
|
<td>Constant time.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre">n::<a href="./value-type.html" class="identifier">value_type</a></span></tt></td>
|
|
<td>An integral type</td>
|
|
<td>Constant time.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre">n::value</span></tt></td>
|
|
<td>An integral constant expression</td>
|
|
<td>Constant time.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre">n::type</span></tt></td>
|
|
<td><a class="reference internal" href="./integral-constant.html">Integral Constant</a></td>
|
|
<td>Constant time.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./next.html" class="identifier">next</a><n>::type</span></tt></td>
|
|
<td><a class="reference internal" href="./integral-constant.html">Integral Constant</a></td>
|
|
<td>Constant time.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./prior.html" class="identifier">prior</a><n>::type</span></tt></td>
|
|
<td><a class="reference internal" href="./integral-constant.html">Integral Constant</a></td>
|
|
<td>Constant time.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre">n::<a href="./value-type.html" class="identifier">value_type</a></span> <span class="pre">const</span> <span class="pre">c</span> <span class="pre">=</span> <span class="pre">n()</span></tt></td>
|
|
<td> </td>
|
|
<td>Constant time.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="section" id="id1219">
|
|
<h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3>
|
|
<table border="1" class="docutils table">
|
|
<colgroup>
|
|
<col width="40%" />
|
|
<col width="60%" />
|
|
</colgroup>
|
|
<thead valign="bottom">
|
|
<tr><th class="head">Expression</th>
|
|
<th class="head">Semantics</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody valign="top">
|
|
<tr><td><tt class="literal"><span class="pre">n::tag</span></tt></td>
|
|
<td><tt class="literal"><span class="pre">n</span></tt>'s tag type; <tt class="literal"><span class="pre">n::tag::value</span></tt> is <tt class="literal"><span class="pre">n</span></tt>'s
|
|
<em>conversion rank</em>.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre">n::<a href="./value-type.html" class="identifier">value_type</a></span></tt></td>
|
|
<td>A cv-unqualified type of <tt class="literal"><span class="pre">n::value</span></tt>.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre">n::value</span></tt></td>
|
|
<td>The value of the wrapped integral constant.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre">n::type</span></tt></td>
|
|
<td><tt class="literal"><span class="pre">is_same<n::type,n>::value</span> <span class="pre">==</span> <span class="pre">true</span></tt>.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./next.html" class="identifier">next</a><n>::type</span></tt></td>
|
|
<td>An <a class="reference internal" href="./integral-constant.html">Integral Constant</a> <tt class="literal"><span class="pre">c</span></tt> of type <tt class="literal"><span class="pre">n::<a href="./value-type.html" class="identifier">value_type</a></span></tt>
|
|
such that <tt class="literal"><span class="pre">c::value</span> <span class="pre">==</span> <span class="pre">n::value</span> <span class="pre">+</span> <span class="pre">1</span></tt>.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./prior.html" class="identifier">prior</a><n>::type</span></tt></td>
|
|
<td>An <a class="reference internal" href="./integral-constant.html">Integral Constant</a> <tt class="literal"><span class="pre">c</span></tt> of type <tt class="literal"><span class="pre">n::<a href="./value-type.html" class="identifier">value_type</a></span></tt>
|
|
such that <tt class="literal"><span class="pre">c::value</span> <span class="pre">==</span> <span class="pre">n::value</span> <span class="pre">-</span> <span class="pre">1</span></tt>.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre">n::<a href="./value-type.html" class="identifier">value_type</a></span> <span class="pre">const</span> <span class="pre">c</span> <span class="pre">=</span> <span class="pre">n()</span></tt></td>
|
|
<td><tt class="literal"><span class="pre">c</span> <span class="pre">==</span> <span class="pre">n::value</span></tt>.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="section" id="id1220">
|
|
<h3><a class="subsection-title" href="#models" name="models">Models</a></h3>
|
|
<ul class="simple">
|
|
<li><a class="reference internal" href="./bool.html">bool_</a></li>
|
|
<li><a class="reference internal" href="./int.html">int_</a></li>
|
|
<li><a class="reference internal" href="./long.html">long_</a></li>
|
|
<li><a class="reference internal" href="./char.html">char_</a></li>
|
|
<li><a class="reference internal" href="./integral-c.html">integral_c</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="section" id="id1221">
|
|
<h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3>
|
|
<p><a class="reference internal" href="./data-types.html">Data Types</a>, <a class="reference internal" href="./integral-sequence-wrapper.html">Integral Sequence Wrapper</a>, <a class="reference internal" href="./integral-c.html">integral_c</a></p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="footer-separator"></div>
|
|
<table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./data-types-concepts.html" class="navigation-link">Prev</a> <a href="./numeric.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group">Back Along</span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./data-types-concepts.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
|
|
<td><div class="copyright-footer"><div class="copyright">Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams</div>
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</div></td></tr></table></body>
|
|
</html>
|