| description | Learn more about: add_volatile Class | ||
|---|---|---|---|
| title | add_volatile Class | ||
| ms.date | 11/04/2016 | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| ms.assetid | cde57277-d764-402d-841e-97611ebaab14 |
Makes a volatile type from the specified type.
template <class Ty>
struct add_volatile;
template <class T>
using add_volatile_t = typename add_volatile<T>::type;T
The type to modify.
An instance of add_volatile<T> has a member typedef type that is T if T is a reference, a function, or a volatile-qualified type, otherwise volatile T. The alias add_volatile_t is a shortcut to access the member typedef type.
#include <type_traits>
#include <iostream>
int main()
{
std::add_volatile_t<int> *p = (volatile int *)0;
p = p; // to quiet "unused" warning
std::cout << "add_volatile<int> == "
<< typeid(*p).name() << std::endl;
return (0);
}add_volatile<int> == int
Header: <type_traits>
Namespace: std