This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.

2531. future::get should explicitly state that the shared state is released

Section: 32.10.7 [futures.unique.future] Status: C++17 Submitter: Agustín K-ballo Bergé Opened: 2015-09-03 Last modified: 2021-06-06

Priority: 3

View all other issues in [futures.unique.future].

View all issues with C++17 status.

Discussion:

The standard is usually very explicit on when a shared state is released, except for future::get for which it only states valid() == false as a postcondition.

[2016-08 - Chicago]

Thurs AM: Moved to Tentatively Ready

Proposed resolution:

This wording is relative to N4527.

  1. Modify [futures.unique_future] as indicated:

    R future::get();
    R& future<R&>::get();
    void future<void>::get();
    

    -14- Note: as described above, the template and its two required specializations differ only in the return type and return value of the member function get.

    -15- Effects:

    • wait()s until the shared state is ready, then retrieves the value stored in the shared state.;

    • releases any shared state (32.10.5 [futures.state]).

    […]