| Defined in header <type_traits> | ||
|---|---|---|
| template< class T > struct remove_cvref; | (since C++20) | 
If the type T is a reference type, provides the member typedef type which is the type referred to by T with its topmost cv-qualifiers removed. Otherwise type is T with its topmost cv-qualifiers removed.
The behavior of a program that adds specializations for remove_cvref is undefined.
| Name | Definition | 
|---|---|
| type | the type referred by TorTitself if it is not a reference, with top-level cv-qualifiers removed | 
| template< class T > using remove_cvref_t = typename remove_cvref<T>::type; | (since C++20) | 
| template<class T>
struct remove_cvref
{
    typedef std::remove_cv_t<std::remove_reference_t<T>> type;
}; | 
| Feature-test macro | Value | Std | Comment | 
|---|---|---|---|
| __cpp_lib_remove_cvref | 201711L | (C++20) | std::remove_cvref | 
#include <type_traits>
 
int main()
{
    static_assert(std::is_same_v<std::remove_cvref_t<int>, int>);
    static_assert(std::is_same_v<std::remove_cvref_t<int&>, int>);
    static_assert(std::is_same_v<std::remove_cvref_t<int&&>, int>);
    static_assert(std::is_same_v<std::remove_cvref_t<const int&>, int>);
    static_assert(std::is_same_v<std::remove_cvref_t<const int[2]>, int[2]>);
    static_assert(std::is_same_v<std::remove_cvref_t<const int(&)[2]>, int[2]>);
    static_assert(std::is_same_v<std::remove_cvref_t<int(int)>, int(int)>);
}| (C++11)(C++11)(C++11) | removes const and/or volatile specifiers from the given type (class template) | 
| (C++11) | removes a reference from the given type (class template) | 
| (C++11) | applies type transformations as when passing a function argument by value (class template) | 
    © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
    https://en.cppreference.com/w/cpp/types/remove_cvref