public member function
<future>
std::future::operator= move (1)future& operator= (future&& rhs) noexcept;copy [deleted] (2)
future& operator= (const future&) = delete;
Move-assign future
Acquires the shared state of rhs (if any).If the object was valid (i.e., it had access to a shared state) before the call, it is disassociated from that shared state. If it was the only object associated to that shared state, the former shared state is itself also destroyed.
rhs is left with no shared state (as if default-constructed): it is no longer valid.
future objects cannot be copied (2).
*this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// future::operator=
#include <iostream> // std::cout
#include <future> // std::async, std::future
int get_value() { return 10; }
int main ()
{
std::future<int> fut; // default-constructed
fut = std::async (get_value); // move-assigned
std::cout << "value: " << fut.get() << '\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