Attaching Extended Futures
This lesson discusses how one extended future can be attached to another in C++20.
The method then
empowers you to attach a future to another future. It often happens that a future will be packed into another future. The job of the unwrapping constructor is to unwrap the outer future.
The proposal N3721
Before I show the first code snippet, I have to say a few words about proposal N3721. Most of this section is from the proposal on “Improvements for std::future
and Related APIs”, including my examples. Strangely, the original authors frequently did not use the final get
call to get the result from the future. Therefore, I added theres.get
call to the examples and saved the result in a variablemyResult
. Additionally, I fixed a few typos.
Get hands-on with 1400+ tech skills courses.