Boost C++ Libraries: Ticket #10552: Add make_valid_future https://svn.boost.org/trac10/ticket/10552 <p> Some functions require that the future are valid. </p> <p> The needs to check for the validity before using these futures. </p> <pre class="wiki">if (fut.valid()) { auto x = fut.then(fct); } if (f1.valid() &amp;&amp; f2.valid()) { auto x = when_all(f1, f2); } </pre><p> 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. </p> <p> In this way the user can always use it as </p> <pre class="wiki">auto x = make_valid_future(fut).then(fct); auto y = when_all(make_valid_future(f1), make_valid_future(f2)); </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10552 Trac 1.4.3 viboes Sun, 28 Sep 2014 22:23:19 GMT owner, status, milestone changed https://svn.boost.org/trac10/ticket/10552#comment:1 https://svn.boost.org/trac10/ticket/10552#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.57.0</span> </li> </ul> <p> <a class="ext-link" href="https://github.com/boostorg/thread/commit/bb72eadbd8fb11a2ae4d7d1999b72015e9e48012"><span class="icon">​</span>https://github.com/boostorg/thread/commit/bb72eadbd8fb11a2ae4d7d1999b72015e9e48012</a> </p> Ticket viboes Wed, 01 Oct 2014 17:32:59 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10552#comment:2 https://svn.boost.org/trac10/ticket/10552#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket