Partager via


reference_wrapper::get

Obtains the wrapped reference.

Ty& get() const;

Remarks

The member function returns INVOKE(get(), t1, t2, ..., tN).

Example

 

// std_tr1__functional__reference_wrapper_get.cpp 
// compile with: /EHsc 
#include <functional> 
#include <iostream> 
 
int main() 
    { 
    int i = 1; 
    std::reference_wrapper<int> rwi(i); 
 
    std::cout << "i = " << i << std::endl; 
    std::cout << "rwi = " << rwi << std::endl; 
    rwi.get() = -1; 
    std::cout << "i = " << i << std::endl; 
 
    return (0); 
    } 
 
i = 1
rwi = 1
i = -1

Requirements

Header: <functional>

Namespace: std

See Also

Reference

reference_wrapper Class

reference_wrapper::operator()