Stay organized with collections Save and categorize content based on your preferences.
Implement ISO/IEC TS 19571:2016 future<T>
.
Creates a new future that unwraps rhs
.
This constructor creates a new shared state that becomes satisfied when both rhs
and rhs.get()
become satisfied. If rhs
is satisfied, but rhs.get()
returns an invalid future then the newly created future becomes satisfied with a std::future_error
exception, and the exception error code is std::future_errc::broken_promise
.
Parameter Name DescriptionNote: The technical specification requires this to be a
noexcept
constructor I (coryan) believe this is a defect in the technical specification, as this creates a new shared state: shared states are dynamically allocated, and the allocator (which might be the defaultoperator new
) may raise.
rhs
future< future< T > > &&
Creates a future from a future whose result type is convertible to this future's result type.
Parameters Name Descriptionrhs
future< U > &&
class U
typename Enable
state
std::shared_ptr< shared_state_type >
Waits until the shared state becomes ready, then retrieves the value stored in the shared state.
Returns Type DescriptionNote: This operation invalidates the future, subsequent calls will fail, the application should capture the returned value because it would.
T
then
Attach a continuation to the future.
Attach a callable func to be invoked when the future is ready. The return type is a future wrapping the return type of func.
Side effects: valid() == false
if the operation is successful.
func
F &&
a Callable to be invoked when the future is ready. The function might be called immediately, e.g., if the future is ready.
typename F
internal::then_helper< F, T >::future_t
`future
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["The document details various versions of the `future` class, spanning from version 2.10.1 up to the latest release candidate 2.37.0-rc."],["The `future` class implements ISO/IEC TS 19571:2016 `future\u003cT\u003e` and provides constructors for creating new futures, including those that unwrap another future or are built from a shared state."],["The `get()` function retrieves the value stored in the shared state once it's ready, and the operation will invalidate the future such that subsequent calls will fail."],["The `then()` function enables attaching a callable to be invoked when the future is ready, potentially being called immediately, and returns a future wrapping the return type of the attached callable function."]]],[]]
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