1 <?xml version=
"1.0" encoding=
"utf-8" ?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en" lang=
"en">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
6 <meta name=
"generator" content=
"Docutils 0.7: http://docutils.sourceforge.net/" />
7 <title>The MPL Reference Manual: Integral Constant
</title>
8 <link rel=
"stylesheet" href=
"../style.css" type=
"text/css" />
10 <body class=
"docframe refmanual">
11 <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>
12 <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>
13 </tr></table><div class=
"header-separator"></div>
14 <div class=
"section" id=
"integral-constant">
15 <h1><a class=
"toc-backref" href=
"./data-types-concepts.html#id1574">Integral Constant
</a></h1>
16 <div class=
"section" id=
"id1217">
17 <h3><a class=
"subsection-title" href=
"#description" name=
"description">Description
</a></h3>
18 <p>An
<a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a> is a holder class for a compile-time value of an
19 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>,
20 returning itself. An integral constant
<em>object
</em> is implicitly convertible to the
21 corresponding run-time value of the wrapped integral type.
</p>
23 <div class=
"section" id=
"id1218">
24 <h3><a class=
"subsection-title" href=
"#expression-requirements" name=
"expression-requirements">Expression requirements
</a></h3>
25 <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>
26 <table border=
"1" class=
"docutils table">
32 <thead valign=
"bottom">
33 <tr><th class=
"head">Expression
</th>
34 <th class=
"head">Type
</th>
35 <th class=
"head">Complexity
</th>
39 <tr><td><tt class=
"literal"><span class=
"pre">n::tag
</span></tt></td>
40 <td><tt class=
"literal"><span class=
"pre">integral_c_tag
</span></tt></td>
41 <td>Constant time.
</td>
43 <tr><td><tt class=
"literal"><span class=
"pre">n::
<a href=
"./value-type.html" class=
"identifier">value_type
</a></span></tt></td>
44 <td>An integral type
</td>
45 <td>Constant time.
</td>
47 <tr><td><tt class=
"literal"><span class=
"pre">n::value
</span></tt></td>
48 <td>An integral constant expression
</td>
49 <td>Constant time.
</td>
51 <tr><td><tt class=
"literal"><span class=
"pre">n::type
</span></tt></td>
52 <td><a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a></td>
53 <td>Constant time.
</td>
55 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./next.html" class=
"identifier">next
</a><n
>::type
</span></tt></td>
56 <td><a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a></td>
57 <td>Constant time.
</td>
59 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./prior.html" class=
"identifier">prior
</a><n
>::type
</span></tt></td>
60 <td><a class=
"reference internal" href=
"./integral-constant.html">Integral Constant
</a></td>
61 <td>Constant time.
</td>
63 <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>
65 <td>Constant time.
</td>
70 <div class=
"section" id=
"id1219">
71 <h3><a class=
"subsection-title" href=
"#expression-semantics" name=
"expression-semantics">Expression semantics
</a></h3>
72 <table border=
"1" class=
"docutils table">
77 <thead valign=
"bottom">
78 <tr><th class=
"head">Expression
</th>
79 <th class=
"head">Semantics
</th>
83 <tr><td><tt class=
"literal"><span class=
"pre">n::tag
</span></tt></td>
84 <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
85 <em>conversion rank
</em>.
</td>
87 <tr><td><tt class=
"literal"><span class=
"pre">n::
<a href=
"./value-type.html" class=
"identifier">value_type
</a></span></tt></td>
88 <td>A cv-unqualified type of
<tt class=
"literal"><span class=
"pre">n::value
</span></tt>.
</td>
90 <tr><td><tt class=
"literal"><span class=
"pre">n::value
</span></tt></td>
91 <td>The value of the wrapped integral constant.
</td>
93 <tr><td><tt class=
"literal"><span class=
"pre">n::type
</span></tt></td>
94 <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>
96 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./next.html" class=
"identifier">next
</a><n
>::type
</span></tt></td>
97 <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>
98 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>
100 <tr><td><tt class=
"literal"><span class=
"pre"><a href=
"./prior.html" class=
"identifier">prior
</a><n
>::type
</span></tt></td>
101 <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>
102 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>
104 <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>
105 <td><tt class=
"literal"><span class=
"pre">c
</span> <span class=
"pre">==
</span> <span class=
"pre">n::value
</span></tt>.
</td>
110 <div class=
"section" id=
"id1220">
111 <h3><a class=
"subsection-title" href=
"#models" name=
"models">Models
</a></h3>
113 <li><a class=
"reference internal" href=
"./bool.html">bool_
</a></li>
114 <li><a class=
"reference internal" href=
"./int.html">int_
</a></li>
115 <li><a class=
"reference internal" href=
"./long.html">long_
</a></li>
116 <li><a class=
"reference internal" href=
"./char.html">char_
</a></li>
117 <li><a class=
"reference internal" href=
"./integral-c.html">integral_c
</a></li>
120 <div class=
"section" id=
"id1221">
121 <h3><a class=
"subsection-title" href=
"#see-also" name=
"see-also">See also
</a></h3>
122 <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>
126 <div class=
"footer-separator"></div>
127 <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>
128 <td><div class=
"copyright-footer"><div class=
"copyright">Copyright ©
2001-
2009 Aleksey Gurtovoy and David Abrahams
</div>
129 Distributed under the Boost Software License, Version
1.0. (See accompanying
130 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>