std::remove_cv,std::remove_const,std::remove_volatile (3) - Linux Manuals
std::remove_cv,std::remove_const,std::remove_volatile: std::remove_cv,std::remove_const,std::remove_volatile
NAME
std::remove_cv,std::remove_const,std::remove_volatile - std::remove_cv,std::remove_const,std::remove_volatile
Synopsis
Defined in header <type_traits>
template< class T > (1) (since C++11)
struct remove_cv;
template< class T > (2) (since C++11)
struct remove_const;
template< class T > (3) (since C++11)
struct remove_volatile;
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 > (since C++14)
using remove_cv_t = typename remove_cv<T>::type;
template< class T > (since C++14)
using remove_const_t = typename remove_const<T>::type;
template< class T > (since C++14)
using remove_volatile_t = typename remove_volatile<T>::type;
Possible implementation
Example
Removing const/volatile from const volatile int * does not modify the type, because the pointer itself is neither const nor volatile.
// Run this code
Output:
See also
is_const checks if a type is const-qualified
(C++11)
is_volatile checks if a type is volatile-qualified
(C++11)
add_cv
add_const
add_volatile adds const or/and volatile specifiers to the given type
(C++11)
(C++11)
(C++11)
remove_cvref combines std::remove_cv and std::remove_reference
(C++20)