Skip to content

Latest commit

 

History

History
69 lines (54 loc) · 1.54 KB

add-volatile-class.md

File metadata and controls

69 lines (54 loc) · 1.54 KB
title ms.custom ms.date ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
add_volatile Class | Microsoft Docs
11/04/2016
cpp-standard-libraries
article
type_traits/std::add_volatile
C++
add_volatile class
add_volatile
cde57277-d764-402d-841e-97611ebaab14
21
corob-msft
corob
ghogen

add_volatile Class

Makes a 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

T
The type to modify.

Remarks

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.

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

See Also

<type_traits>
remove_volatile Class