Share via


add_cv Class

Makes const/volatile type from type.

template<class Ty>
    struct add_cv;

template<class T>
using add_cv_t = typename add_cv<T>::type;

Parameters

  • Ty
    The type to modify.

Remarks

An instance of the type modifier holds the modified-type add_volatile Class< add_const Class<Ty> >.

Example

 

#include <type_traits> 
#include <iostream> 
 
int main() 
    { 
    std::add_cv_t<int> *p = (const volatile int *)0; 
 
    p = p;  // to quiet "unused" warning 
    std::cout << "add_cv<int> == " 
        << typeid(*p).name() << std::endl; 
 
    return (0); 
    } 
 
add_cv_t<int> == int

Requirements

Header: <type_traits>

Namespace: std

See Also

Reference

<type_traits>

remove_const Class

remove_volatile Class