[Boost-bugs] [Boost C++ Libraries] #10552: Add make_valid_future

Subject: [Boost-bugs] [Boost C++ Libraries] #10552: Add make_valid_future
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-09-27 16:39:37


#10552: Add make_valid_future
------------------------------+----------------------
 Reporter: viboes | Owner: anthonyw
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: |
------------------------------+----------------------
 Some functions require that the future are valid.

 The needs to check for the validity before using these futures.

 {{{
 if (fut.valid()) {
   auto x = fut.then(fct);
 }
 if (f1.valid() && f2.valid()) {
   auto x = when_all(f1, f2);
 }

 }}}

 An alternative is to provide a make_valid_future function that ensure that
 the result is valid. If the input future is valid it return the same
 future, otherwise it sets an exception future_error, and the corresponding
 error condition would be std::future_errc::no_state.

 In this way the user can always use it as


 {{{
 auto x = make_valid_future(fut).then(fct);

 auto y = when_all(make_valid_future(f1), make_valid_future(f2));
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10552>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC