Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The latest version of this topic can be found at add_volatile Class.
Makes volatile type from the specified type.
Syntax
template <class Ty>
struct add_volatile;
template <class T>using add_volatile_t = typename add_volatile<T>::type;
Parameters
Ty
The type to modify.
Remarks
An instance of the type modifier holds a modified-type that is Ty
if Ty
is a reference, a function, or a volatile-qualified type, otherwise volatile Ty
.
Example
#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
Requirements
Header: <type_traits>
Namespace: std