Export (0) Print
Expand All
Expand Minimize
0 out of 1 rated this helpful - Rate this topic

add_reference Class

Makes reference to type from type.

template<class Ty>
    struct add_reference;
Ty

The type to modify.

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

 

// std_tr1__type_traits__add_reference.cpp 
// compile with: /EHsc 
#include <type_traits> 
#include <iostream> 
 
int main() 
    { 
    int val = 0; 
    std::add_reference<int>::type p = (int&)val; 
 
    p = p;  // to quiet "unused" warning 
    std::cout << "add_reference<int> == " 
        << typeid(p).name() << std::endl; 
 
    return (0); 
    } 
 
add_reference<int> == int

Header: <type_traits>

Namespace: std

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.