boost::mpl::Integral Constant

# Integral Constant

### Description

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_type` | An integral type
`typename n::type` | A model of Integral Constant
`n::value` | A compile-time integral constant of `n::value_type`
`typename n::next` | A model of Integral Constant
`typename n::prior` | A model of Integral Constant

### Expression semantics

Expression | Complexity | Precondition | Semantics | Postcondition
--- | --- | --- | --- | ---
`typename n::value_type` | Amortized constant time |  | `n::value_type` is identical to `typeof(n::value)` |
`typename n::type` | Amortized constant time |  | Self-reference. | `is_same<n::type,n>::value == true`
`n::value` | Amortized constant time |  | Value of `n`. |
`typename n::next` | Amortized constant time | `n::value_type` supports an increment operation; `n::value` is incrementable | Increment operation | `n::next::value == n::value + 1`
`typename n::prior` | Amortized constant time | `n::value_type` supports an decrement operation; `n::value` is decrementable | Decrement operation | `n::prior::value == n::value - 1`

### Models

- `integral_c`
- `int_`
- `bool_`

### See also

`next`, `prior`

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