std::remove_cv, std::remove_const, std::remove_volatile

From cppreference.com
< cpp‎ | types
 
 
 
Type support
Basic types
Fundamental types
Fixed width integer types (C++11)
Numeric limits
C numeric limits interface
Runtime type information
Type traits
Type categories
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Type properties
(C++11)
(C++11)
(C++11)
(C++14)
(C++11)
(C++11)(deprecated in C++17)
(C++11)
Type trait constants
Metafunctions
(C++17)
Supported operations
Relationships and property queries
(C++11)
(C++11)
(C++11)
(C++11)
Type modifications
remove_cvremove_constremove_volatile
(C++11)(C++11)(C++11)
(C++11)(C++11)(C++11)
Type transformations
(C++11)
(C++11)
(C++17)
(C++11)(deprecated in C++17)(C++17)
 
Defined in header <type_traits>
template< class T >
struct remove_cv;
(1) (since C++11)
template< class T >
struct remove_const;
(2) (since C++11)
template< class T >
struct remove_volatile;
(3) (since C++11)

Provides the member typedef type which is the same as T, except that its topmost cv-qualifiers are removed.

1) removes the topmost const, the topmost volatile, or both, if present.

2) removes the topmost const

3) removes the topmost volatile

Member types

Name Definition
type the type T without cv-qualifier

Helper types

template< class T >
using remove_cv_t       = typename remove_cv<T>::type;
(since C++14)
template< class T >
using remove_const_t    = typename remove_const<T>::type;
(since C++14)
template< class T >
using remove_volatile_t = typename remove_volatile<T>::type;
(since C++14)

Possible implementation

template< class T >
struct remove_cv {
    typedef typename std::remove_volatile<typename std::remove_const<T>::type>::type type;
};
 
template< class T > struct remove_const          { typedef T type; };
template< class T > struct remove_const<const T> { typedef T type; };
 
template< class T > struct remove_volatile             { typedef T type; };
template< class T > struct remove_volatile<volatile T> { typedef T type; };