2004-11-28 03:35:12 +00:00
<?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" / >
2010-08-09 20:07:24 +00:00
< meta name = "generator" content = "Docutils 0.7: http://docutils.sourceforge.net/" / >
2004-11-28 03:35:12 +00:00
< title > The MPL Reference Manual: Integral Constant< / title >
< link rel = "stylesheet" href = "../style.css" type = "text/css" / >
< / head >
< body class = "docframe refmanual" >
2009-08-17 11:30:52 +00:00
< 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 >
2004-11-28 03:35:12 +00:00
< / tr > < / table > < div class = "header-separator" > < / div >
< div class = "section" id = "integral-constant" >
2010-08-09 20:07:24 +00:00
< h1 > < a class = "toc-backref" href = "./data-types-concepts.html#id1574" > Integral Constant< / a > < / h1 >
2009-08-17 11:30:52 +00:00
< div class = "section" id = "id1217" >
2004-11-28 03:35:12 +00:00
< h3 > < a class = "subsection-title" href = "#description" name = "description" > Description< / a > < / h3 >
2009-08-17 11:30:52 +00:00
< 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
2004-11-28 03:35:12 +00:00
corresponding run-time value of the wrapped integral type.< / p >
< / div >
2009-08-17 11:30:52 +00:00
< div class = "section" id = "id1218" >
2004-11-28 03:35:12 +00:00
< h3 > < a class = "subsection-title" href = "#expression-requirements" name = "expression-requirements" > Expression requirements< / a > < / h3 >
2009-08-17 11:30:52 +00:00
< 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" >
2004-11-28 03:35:12 +00:00
< colgroup >
< col width = "35%" / >
< col width = "39%" / >
< col width = "27%" / >
< / colgroup >
< thead valign = "bottom" >
2009-08-17 11:30:52 +00:00
< tr > < th class = "head" > Expression< / th >
< th class = "head" > Type< / th >
< th class = "head" > Complexity< / th >
2004-11-28 03:35:12 +00:00
< / tr >
< / thead >
< tbody valign = "top" >
2009-08-17 11:30:52 +00:00
< 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 >
2004-11-28 03:35:12 +00:00
< 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 >
2009-08-17 11:30:52 +00:00
< td > < a class = "reference internal" href = "./integral-constant.html" > Integral Constant< / a > < / td >
2004-11-28 03:35:12 +00:00
< 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 >
2009-08-17 11:30:52 +00:00
< td > < a class = "reference internal" href = "./integral-constant.html" > Integral Constant< / a > < / td >
2004-11-28 03:35:12 +00:00
< 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 >
2009-08-17 11:30:52 +00:00
< td > < a class = "reference internal" href = "./integral-constant.html" > Integral Constant< / a > < / td >
2004-11-28 03:35:12 +00:00
< 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 >
2009-08-17 11:30:52 +00:00
< div class = "section" id = "id1219" >
2004-11-28 03:35:12 +00:00
< h3 > < a class = "subsection-title" href = "#expression-semantics" name = "expression-semantics" > Expression semantics< / a > < / h3 >
2009-08-17 11:30:52 +00:00
< table border = "1" class = "docutils table" >
2004-11-28 03:35:12 +00:00
< colgroup >
< col width = "40%" / >
< col width = "60%" / >
< / colgroup >
< thead valign = "bottom" >
2009-08-17 11:30:52 +00:00
< tr > < th class = "head" > Expression< / th >
< th class = "head" > Semantics< / th >
2004-11-28 03:35:12 +00:00
< / tr >
< / thead >
< tbody valign = "top" >
2009-08-17 11:30:52 +00:00
< 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 >
2004-11-28 03:35:12 +00:00
< 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 >
2009-08-17 11:30:52 +00:00
< 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 >
2004-11-28 03:35:12 +00:00
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 >
2009-08-17 11:30:52 +00:00
< 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 >
2004-11-28 03:35:12 +00:00
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 >
2009-08-17 11:30:52 +00:00
< div class = "section" id = "id1220" >
2004-11-28 03:35:12 +00:00
< h3 > < a class = "subsection-title" href = "#models" name = "models" > Models< / a > < / h3 >
< ul class = "simple" >
2009-08-17 11:30:52 +00:00
< 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 >
2004-11-28 03:35:12 +00:00
< / ul >
< / div >
2009-08-17 11:30:52 +00:00
< div class = "section" id = "id1221" >
2004-11-28 03:35:12 +00:00
< h3 > < a class = "subsection-title" href = "#see-also" name = "see-also" > See also< / a > < / h3 >
2009-08-17 11:30:52 +00:00
< 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 >
2004-11-28 03:35:12 +00:00
< / div >
< / div >
< div class = "footer-separator" > < / div >
2009-08-17 11:30:52 +00:00
< 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 >
2004-11-28 03:35:12 +00:00
< / html >