As per the documentation(http://www.cplusplus.com/reference/future/future/get/), which says that: [emphasis mine]
Once the shared state is ready, the function unblocks and returns (or throws) releasing its shared state. This makes the future object no longer valid: this member function shall be called once at most for every future shared state.
As per the documentation(http://www.cplusplus.com/reference/future/future/), which says that: [emphasis mine]
"Valid" futures are future objects associated to a shared state, and are constructed by calling one of the following functions
async
promise::get_future
packaged_task::get_future
As per the documentation(http://www.cplusplus.com/reference/future/future/get/), which says that: [emphasis mine]
std::future::get
generic template (1) T get(); reference
specialization (2) R& future::get(); // when T is a reference
type (R&) void specialization (3) void future::get(); // when T is void
Return:
value Generally (1), std::move(x), where x is the value stored in the shared state.
For references (2), a reference to the value stored in the shared state.
For void futures (3), nothing.
My question is what is the "std::future
shared state"? How can i comprehend "std::future shared state"?
I am a novice in C++.Though I thought and thought about it, but I still can't grasp the idea. I would be very grateful to have some help with this question.