is_volatile Class

Tests if type is volatile.

template<class Ty>
    struct is_volatile;

Parameters

  • Ty
    The type to query.

Remarks

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

Example

 

// 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::is_volatile<trivial>::value << std::endl; 
    std::cout << "is_volatile<volatile trivial> == " << std::boolalpha 
        << std::is_volatile<volatile trivial>::value << std::endl; 
    std::cout << "is_volatile<int> == " << std::boolalpha 
        << std::is_volatile<int>::value << std::endl; 
    std::cout << "is_volatile<volatile int> == " << std::boolalpha 
        << std::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

Requirements

Header: <type_traits>

Namespace: std

See Also

Reference

<type_traits>

is_const Class

Other Resources

<type_traits> Members