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
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

is_volatile Class

Tests if type is volatile.

template<class Ty>
    struct is_volatile;

Ty

The type to query.

An instance of the type predicate holds true if Ty is volatile-qualified.

 

// std_tr1__type_traits__is_volatile.cpp 
// compile with: /EHsc 
#include <type_traits> 
#include <iostream> 
 
struct trivial 
    { 
    int val; 
    }; 
 
int main() 
    { 
    std::cout << "is_volatile<trivial> == " << std::boolalpha 
        << std::tr1::is_volatile<trivial>::value << std::endl; 
    std::cout << "is_volatile<volatile trivial> == " << std::boolalpha 
        << std::tr1::is_volatile<volatile trivial>::value << std::endl; 
    std::cout << "is_volatile<int> == " << std::boolalpha 
        << std::tr1::is_volatile<int>::value << std::endl; 
    std::cout << "is_volatile<volatile int> == " << std::boolalpha 
        << std::tr1::is_volatile<volatile int>::value << std::endl; 
 
    return (0); 
    } 
 
is_volatile<trivial> == false is_volatile<volatile trivial> == true is_volatile<int> == false is_volatile<volatile int> == true

Header: <type_traits>

Namespace: std::tr1

Community Additions

ADD
Show:
© 2015 Microsoft