A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.com/reference/type_traits/remove_volatile/ below:

class template

<type_traits>

std::remove_volatile
template <class T> struct remove_volatile;

Remove volatile qualification

Obtains the type T without top-level volatile qualification.

The transformed type is aliased as member type remove_volatile::type.

If T is volatile-qualified, this is the same type as T but with its volatile-qualification removed. Otherwise, it is T unchanged.

Notice that this class merely obtains a type using another type as model, but it does not transform values or objects between those types. To explicitly remove the volatile-qualifier of an object, const_cast can be used.



Template parameters
T
A type.

Member types member type definition type If T is volatile-qualified, the same type as T but with the volatile-qualification removed.
Otherwise, T
Example
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;
}

Output:
type of d is not volatile


See also
add_volatile
Add volatile qualification (class template)
remove_cv
Remove cv qualification (class template)
remove_const
Remove const qualification (class template)
remove_reference
Remove reference (class template)
remove_pointer
Remove pointer (class template)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4