1304. Missing preconditions for shared_future

Section: 33.6.8 [futures.shared_future] Status: Resolved Submitter: Alisdair Meredith Opened: 2010-01-23 Last modified: 2016-02-10

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 EditorialResolved. Rationale added below.

Rationale:

Solved by N3058.

Proposed resolution:

Insert the following extra paragraphs:

In 33.6.8 [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 ...