Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

add_const Class

Makes const type from type.

template<class Ty>
    struct add_const;

Ty

The type to modify.

An instance of the type modifier holds a modified-type that is Ty if Ty is a reference, a function, or a const-qualified type, otherwise const Ty.

 

// std_tr1__type_traits__add_const.cpp 
// compile with: /EHsc 
#include <type_traits> 
#include <iostream> 
 
int main() 
    { 
    std::add_const<int>::type *p = (const int *)0; 
 
    p = p;  // to quiet "unused" warning 
    std::cout << "add_const<int> == " 
        << typeid(*p).name() << std::endl; 
 
    return (0); 
    } 
 
add_const<int> == int

Header: <type_traits>

Namespace: std

Show:
© 2015 Microsoft