function template
<functional>
std::ref reference (1)template <class T> reference_wrapper<T> ref (T& elem) noexcept;copy (2)
template <class T> reference_wrapper<T> ref (reference_wrapper<T>& x) noexcept;move (3)
template <class T> void ref (const T&&) = delete;
Construct reference_wrapper
Constructs an object of the appropriate reference_wrapper type to hold a reference to elem.If the argument is itself a reference_wrapper (2), it creates a copy of x instead.
The function calls the proper reference_wrapper constructor.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// ref example
#include <iostream> // std::cout
#include <functional> // std::ref
int main () {
int foo (10);
auto bar = std::ref(foo);
++bar;
std::cout << foo << '\n';
return 0;
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4