add_lvalue_reference Class
TOC
Collapse the table of content
Expand the table of content

add_lvalue_reference Class

 

Makes reference to type from type.

template<class T>
    struct add_lvalue_reference;

template<class T>
    using add_lvalue_reference_t = typename add_lvalue_reference<T>::type;

T

The type to modify.

An instance of the type modifier holds a modified-type that is T if T is an lvalue reference, otherwise T&.

Example

 

#include <type_traits> 
#include <iostream> 

using namespace std;
int main()
{
    int val = 0;
    add_lvalue_reference_t<int> p = (int&)val;
    p = p;  // to quiet "unused" warning 
    cout << "add_lvalue_reference_t<int> == "
        << typeid(p).name() << endl;

    return (0);
}
add_lvalue_reference_t<int> == int

Requirements

Header: <type_traits>

Namespace: std

Show:
© 2016 Microsoft