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

### 1304. Missing preconditions for `shared_future`

Section: 33.10.8 [futures.shared.future] Status: Resolved Submitter: Alisdair Meredith Opened: 2010-01-23 Last modified: 2021-06-06

Priority: Not Prioritized

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

View all issues with Resolved status.

Discussion:

The revised futures package in the current working paper simplified the `is_ready/has_exception/has_value` set of APIs, replacing them with a single 'valid' method. This method is used in many places to signal pre- and post- conditions, but that edit is not complete. Each method on a `shared_future` that requires an associated state should have a pre-condition that `valid() == true`.

[ 2010-01-28 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]

[ 2010 Pittsburgh: ]

> Moved to NAD Editorial Resolved. Rationale added below.

Rationale:

Solved by N3058.

Proposed resolution:

Insert the following extra paragraphs:

In [futures.shared_future]

>     shared_future();

> > 4 Effects: constructs ...

> > Postcondition: `valid() == false`.

> > Throws: nothing.

>     void wait() const;

> > Requires: `valid() == true`.

> > 22 Effects: if the associated ...

>     template <class Rep, class Period>
>       bool wait_for(const chrono::duration<Rep, Period>& rel_time) const;

> > Requires: `valid() == true`.

> > 23 Effects: if the associated ...

>     template <class Clock, class Duration>
>       bool wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;

> > Requires: `valid() == true`.

> > 25 Effects: blocks until ...