Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is an the documentation for an old version of boost. Click here for the latest Boost documentation.

[Home]Integral Constant


An Integral Constant is a class representing a value of a built-in integral type (bool, int, long, etc.) in compile-time programs. An integral constant directly supports the increment/decrement operations within the range of the built-in integral type it wraps. Other arithmetic operations are supported through the external metafunctions.

Valid expressions

 Expression  Return type  
typename n::value_typeAn integral type
typename n::typeA model of Integral Constant
n::valueA compile-time integral constant of n::value_type
typename n::nextA model of Integral Constant
typename n::priorA model of Integral Constant

Expression semantics

 Expression  Complexity  Precondition  Semantics  Postcondition  
typename n::value_typeAmortized constant timen::value_type is identical to typeof(n::value)
typename n::typeAmortized constant timeSelf-reference.is_same<n::type,n>::value == true
n::valueAmortized constant timeValue of n.
typename n::nextAmortized constant timen::value_type supports an increment operation; n::value is incrementableIncrement operationn::next::value == n::value + 1
typename n::priorAmortized constant timen::value_type supports an decrement operation; n::value is decrementableDecrement operationn::prior::value == n::value - 1


See also

next, prior

Table of Contents
Last edited March 10, 2003 4:21 am