If the type T is a reference type, provides the member typedef type which is the type referred to by T . Otherwise type is T .
If the program adds specializations for std::remove_reference , the behavior is undefined.
Name | Definition |
type | the type referred by T or T if it is not a reference |
template < class T >
using remove_reference_t = typename remove_reference < T >:: type ;
templateclass T> struct remove_reference { typedef T type; }; templateclass T> struct remove_referenceT&> { typedef T type; }; templateclass T> struct remove_referenceT&&> { typedef T type; };
Run this code
#include #include int main() { std::cout std::boolalpha; std::cout "std::remove_reference::type is int? " std::is_sameint, std::remove_referenceint>::type>::value '\n'; std::cout "std::remove_reference::type is int? " std::is_sameint, std::remove_referenceint&>::type>::value '\n'; std::cout "std::remove_reference::type is int? " std::is_sameint, std::remove_referenceint&&>::type>::value '\n'; std::cout "std::remove_reference::type is const int? " std::is_sameconst int, std::remove_referenceconst int&>::type>::value '\n'; }
std::remove_reference::type is int? true std::remove_reference::type is int? true std::remove_reference::type is int? true std::remove_reference::type is const int? true