Type traits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Compile-time rational arithmetic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Compile-time integer sequences | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(C++14) |
Defined in header <type_traits> | ||
template<class T> struct remove_cvref; | (since C++20) | |
If the typeT
is a reference type, provides the member typedeftype
which is the type referred to byT
with its topmost cv-qualifiers removed. Otherwisetype
isT
with its topmost cv-qualifiers removed.
If the program adds specializations forstd::remove_cvref
, the behavior is undefined.
Contents |
Name | Definition |
type | the type referred byT orT itself if it is not a reference, with top-level cv-qualifiers removed |
template<class T> using remove_cvref_t= remove_cvref<T>::type; | (since C++20) | |
template<class T>struct remove_cvref{using type=std::remove_cv_t<std::remove_reference_t<T>>;}; |
Feature-test macro | Value | Std | Feature |
---|---|---|---|
__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<constint&>,int>); static_assert(std::is_same_v<std::remove_cvref_t<constint[2]>,int[2]>); static_assert(std::is_same_v<std::remove_cvref_t<constint(&)[2]>,int[2]>); static_assert(std::is_same_v<std::remove_cvref_t<int(int)>,int(int)>);}
(C++11)(C++11)(C++11) | removesconst and/orvolatile specifiers from the given type (class template)[edit] |
(C++11) | removes a reference from the given type (class template)[edit] |
(C++11) | applies type transformations as when passing a function argument by value (class template)[edit] |