1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
// remove_volatile example
#include <iostream>
#include <type_traits>
int main() {
typedef volatile int vint;
std::remove_volatile<vint>::type a; // int a
std::remove_volatile<const volatile int>::type b = 0; // const int b
std::remove_volatile<volatile int*>::type c; // volatile int* c
std::remove_volatile<int* volatile>::type d; // int* d
if (std::is_volatile<decltype(d)>::value)
std::cout << "type of d is volatile" << std::endl;
else
std::cout << "type of d is not volatile" << std::endl;
return 0;
}
|