GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::remove_reference(3) C++ Standard Libary std::remove_reference(3)

std::remove_reference - std::remove_reference


Defined in header <type_traits>
template< class T > (since C++11)
struct remove_reference;


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.


The behavior of a program that adds specializations for remove_reference is
undefined.


Name Definition
type the type referred by T or T if it is not a reference


template< class T > (since C++14)
using remove_reference_t = typename remove_reference<T>::type;


template< class T > struct remove_reference { typedef T type; };
template< class T > struct remove_reference<T&> { typedef T type; };
template< class T > struct remove_reference<T&&> { typedef T type; };

// Run this code


#include <iostream>
#include <type_traits>


int main() {
std::cout << std::boolalpha;


std::cout << "std::remove_reference<int>::type is int? "
<< std::is_same<int, std::remove_reference<int>::type>::value << '\n';
std::cout << "std::remove_reference<int&>::type is int? "
<< std::is_same<int, std::remove_reference<int&>::type>::value << '\n';
std::cout << "std::remove_reference<int&&>::type is int? "
<< std::is_same<int, std::remove_reference<int&&>::type>::value << '\n';
std::cout << "std::remove_reference<const int&>::type is const int? "
<< std::is_same<const int,
std::remove_reference<const int&>::type>::value << '\n';
}


std::remove_reference<int>::type is int? true
std::remove_reference<int&>::type is int? true
std::remove_reference<int&&>::type is int? true
std::remove_reference<const int&>::type is const int? true


is_reference checks if a type is either a lvalue reference or rvalue
(C++11) reference
(class template)
add_lvalue_reference
add_rvalue_reference adds a lvalue or rvalue reference to the given type
(C++11) (class template)
(C++11)
remove_cvref combines std::remove_cv and std::remove_reference
(C++20) (class template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.