Export (0) Print
Expand All
Expand Minimize

integral_constant Class

Makes integral constant fromt type and value.

template <class Ty, Ty v>
    struct integral_constant;

Ty

The type of the constant.

Ty

The value of the constant.

The template class, when specialized with an integral type and a value of that type, represents an object that holds a constant of that integral type with the specified value.

 

// std_tr1__type_traits__integral_constant.cpp 
// compile with: /EHsc 
#include <type_traits> 
#include <iostream> 
 
int main() 
    { 
    std::cout << "integral_constant<int, 5> == " 
        << std::integral_constant<int, 5>::value << std::endl; 
    std::cout << "integral_constant<bool, false> == " << std::boolalpha 
        << std::integral_constant<bool, false>::value << std::endl; 
 
    return (0); 
    } 
 
integral_constant<int, 5> == 5
integral_constant<bool, false> == false

Header: <type_traits>

Namespace: std

Show:
© 2014 Microsoft