continuable/group___base.html
2018-03-17 13:27:07 +01:00

405 lines
33 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-115514125-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-115514125-1');
</script>
<meta charset="UTF-8" />
<title>Base module | Continuable</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
<link rel="stylesheet" href="m-dark+doxygen.compiled.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
<link rel="stylesheet" href="base.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
<link rel="stylesheet" href="terminal.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
<link rel="stylesheet" href="atom-one-dark.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#23373B" />
</head>
<body>
<header><nav id="navigation">
<div class="m-container">
<div class="m-row">
<a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">Continuable <span class="m-thin">3.0.0</span></a>
<div class="m-col-t-4 m-hide-m m-text-right m-nopadr">
<a href="#search" class="m-dox-search-icon" title="Search" onclick="return showSearch()"><svg viewBox="0 0 16 16">
<path d="m6 0c-3.3144 0-6 2.6856-6 6 0 3.3144 2.6856 6 6 6 1.4858 0 2.8463-0.54083 3.8945-1.4355-0.0164 0.33797 0.14734 0.75854 0.5 1.1504l3.2227 3.7891c0.55185 0.6139 1.4517 0.66544 2.002 0.11524 0.55022-0.55022 0.49866-1.4501-0.11524-2.002l-3.7891-3.2246c-0.39184-0.35266-0.81242-0.51469-1.1504-0.5 0.89472-1.0482 1.4355-2.4088 1.4355-3.8945 0-3.3128-2.6856-5.998-6-5.998zm0 1.5625a4.4375 4.4375 0 0 1 4.4375 4.4375 4.4375 4.4375 0 0 1-4.4375 4.4375 4.4375 4.4375 0 0 1-4.4375-4.4375 4.4375 4.4375 0 0 1 4.4375-4.4375z"/>
</svg></a>
<a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
<a id="m-navbar-hide" href="#" title="Hide navigation"></a>
</div>
<div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
<div class="m-row">
<ol class="m-col-t-6 m-col-m-none">
<li>
<a href="tutorial.html">Tutorial</a>
<ol>
<li><a href="tutorial-creating-continuables.html">Creating continuables</a></li>
<li><a href="tutorial-chaining-continuables.html">Chaining continuables</a></li>
<li><a href="tutorial-connecting-continuables.html">Connecting continuables</a></li>
<li><a href="tutorial-transforming-continuables.html">Transforming continuables</a></li>
<li><a href="tutorial-awaiting-continuables.html">Awaiting continuables</a></li>
<li><a href="tutorial-promisify-continuables.html">Promisify functions</a></li>
</ol>
</li>
<li>
<a href="pages.html">Pages</a>
<ol>
<li><a href="installation.html">Installation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="configuration.html">Configuration</a></li>
<li><a href="changelog.html">Changelog</a></li>
</ol>
</li>
<li>
<a href="modules.html">Modules</a>
<ol>
<li><a href="group___base.html" id="m-navbar-current">Base</a></li>
<li><a href="group___connections.html">Connections</a></li>
<li><a href="group___promisify.html">Promisify</a></li>
<li><a href="group___testing.html">Testing</a></li>
<li><a href="group___types.html">Types</a></li>
<li><a href="group___transforms.html">Transforms</a></li>
<li><a href="group___traversal.html">Traversal</a></li>
</ol>
</li>
</ol>
<ol class="m-col-t-6 m-col-m-none" start="4">
<li>
<a href="namespacecti.html">cti</a>
<ol>
<li><a href="namespacecti_1_1transforms.html">cti::transforms</a></li>
<li><a href="classcti_1_1continuable__base.html">cti::continuable_base</a></li>
<li><a href="classcti_1_1promise__base.html">cti::promise_base</a></li>
</ol>
</li>
<li class="m-show-m"><a href="#search" class="m-dox-search-icon" title="Search" onclick="return showSearch()"><svg viewBox="0 0 16 16">
<path d="m6 0c-3.3144 0-6 2.6856-6 6 0 3.3144 2.6856 6 6 6 1.4858 0 2.8463-0.54083 3.8945-1.4355-0.0164 0.33797 0.14734 0.75854 0.5 1.1504l3.2227 3.7891c0.55185 0.6139 1.4517 0.66544 2.002 0.11524 0.55022-0.55022 0.49866-1.4501-0.11524-2.002l-3.7891-3.2246c-0.39184-0.35266-0.81242-0.51469-1.1504-0.5 0.89472-1.0482 1.4355-2.4088 1.4355-3.8945 0-3.3128-2.6856-5.998-6-5.998zm0 1.5625a4.4375 4.4375 0 0 1 4.4375 4.4375 4.4375 4.4375 0 0 1-4.4375 4.4375 4.4375 4.4375 0 0 1-4.4375-4.4375 4.4375 4.4375 0 0 1 4.4375-4.4375z"/>
</svg> Search</a></li>
</ol>
<ol class="m-col-t-6 m-col-m-none">
<li>
<a href="https://github.com/Naios/continuable" aria-label="View source on Github"><i class="fa fa-github"></i> Code</a>
</li>
</ol>
</div>
</div>
</div>
</div>
</nav></header>
<main><article>
<div class="m-container m-container-inflatable">
<div class="m-row">
<div class="m-col-l-10 m-push-l-1">
<h1>
Base <span class="m-thin">module</span></h1>
<p>provides classes and functions to create <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects.</p>
<div class="m-block m-default">
<h3>Contents</h3>
<ul>
<li>
Reference
<ul>
<li><a href="#nested-classes">Classes</a></li>
<li><a href="#typedef-members">Typedefs</a></li>
<li><a href="#func-members">Functions</a></li>
</ul>
</li>
</ul>
</div>
<section id="nested-classes">
<h2><a href="#nested-classes">Classes</a></h3>
<dl class="m-dox">
<dt>
<div class="m-dox-template">template&lt;typename Data, typename Annotation&gt;</div>
class <a href="classcti_1_1continuable__base.html" class="m-dox">cti::continuable_base</a>
</dt>
<dd>The main class of the continuable library, it provides the functionality for chaining callbacks and continuations together to a unified hierarchy.</dd>
<dt>
<div class="m-dox-template">template&lt;typename Data, typename Hint&gt;</div>
class <a href="classcti_1_1promise__base.html" class="m-dox">cti::promise_base</a>
</dt>
<dd>The <a href="classcti_1_1promise__base.html" class="m-dox">promise_<wbr />base</a> makes it possible to resolve an asynchronous continuable through it&#x27;s result or through an error type.</dd>
</dl>
</section>
<section id="typedef-members">
<h2><a href="#typedef-members">Typedefs</a></h3>
<dl class="m-dox">
<dt>
using <a href="#ga9518a71f87f4d0efd18518c818907a92" class="m-dox">dispatch_error_tag</a> = detail::types::dispatch_error_tag
</dt>
<dd>Represents a tag which can be placed first in a signature in order to overload callables with the asynchronous result as well as an error.</dd>
<dt>
using <a href="#ga7fcba5095c36f2577e1f4a2c5608dc6a" class="m-dox">error_type</a> = detail::types::error_type
</dt>
<dd>Represents the type that is used as error type.</dd>
<dt>
<div class="m-dox-template">template&lt;typename T&gt;</div>
using <a href="#gabe4e73c301a2697d9252c400194474e0" class="m-dox">is_continuable</a> = detail::base::is_continuable&lt;T&gt;
</dt>
<dd>Deduces to a true_type if the given type is a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</dd>
</dl>
</section>
<section id="func-members">
<h2><a href="#func-members">Functions</a></h3>
<dl class="m-dox">
<dt>
<div class="m-dox-template">template&lt;typename... Args, typename Continuation&gt;</div>
<span class="m-dox-wrap-bumper">auto <a href="#gaf47869ea139d88976af5b9654d6d61c0" class="m-dox">make_continuable</a>(</span><span class="m-dox-wrap">Continuation&amp;&amp; continuation) -&gt; auto <span class="m-label m-flat m-primary">constexpr</span></span>
</dt>
<dd>Creates a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> from a promise/callback taking function.</dd>
<dt>
<div class="m-dox-template">template&lt;typename... Args&gt;</div>
<span class="m-dox-wrap-bumper">auto <a href="#gaa638513fe4c0a80b9ad445f8dff91250" class="m-dox">make_ready_continuable</a>(</span><span class="m-dox-wrap">) -&gt; auto <span class="m-label m-flat m-primary">constexpr</span></span>
</dt>
<dd>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with no result which instantly resolves the promise with no values.</dd>
<dt>
<div class="m-dox-template">template&lt;typename Result&gt;</div>
<span class="m-dox-wrap-bumper">auto <a href="#gaad3c8cc144f08d8d3614651ae36f7106" class="m-dox">make_ready_continuable</a>(</span><span class="m-dox-wrap">Result&amp;&amp; result) -&gt; auto <span class="m-label m-flat m-primary">constexpr</span></span>
</dt>
<dd>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with one result value which instantly resolves the promise with the given value.</dd>
<dt>
<div class="m-dox-template">template&lt;typename FirstResult, typename SecondResult, typename... Rest&gt;</div>
<span class="m-dox-wrap-bumper">auto <a href="#gade7f394af50a956c2516bffc29410a9d" class="m-dox">make_ready_continuable</a>(</span><span class="m-dox-wrap">FirstResult&amp;&amp; first_result,
SecondResult&amp;&amp; second_result,
Rest&amp;&amp;... rest) -&gt; auto <span class="m-label m-flat m-primary">constexpr</span></span>
</dt>
<dd>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with multiple result values which instantly resolves the promise with the given values.</dd>
<dt>
<div class="m-dox-template">template&lt;typename... Signature, typename Exception&gt;</div>
<span class="m-dox-wrap-bumper">auto <a href="#ga41794c321aef916f4fd0fe4c36aa9e6e" class="m-dox">make_exceptional_continuable</a>(</span><span class="m-dox-wrap">Exception&amp;&amp; exception) -&gt; auto <span class="m-label m-flat m-primary">constexpr</span></span>
</dt>
<dd>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with the parameterized result which instantly resolves the promise with the given error type.</dd>
</dl>
</section>
<section>
<h2>Typedef documentation</h2>
<section class="m-dox-details" id="ga9518a71f87f4d0efd18518c818907a92"><div>
<h3>
using <a href="#ga9518a71f87f4d0efd18518c818907a92" class="m-dox-self">dispatch_error_tag</a> = detail::types::dispatch_error_tag
</h3>
<p>Represents a tag which can be placed first in a signature in order to overload callables with the asynchronous result as well as an error.</p>
<p>See the example below:</p><pre class="m-code"><span class="k">struct</span> <span class="n">my_callable</span> <span class="p">{</span>
<span class="kt">void</span> <span class="k">operator</span><span class="p">()</span> <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">result</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// ...</span>
<span class="p">}</span>
<span class="kt">void</span> <span class="k">operator</span><span class="p">()</span> <span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">dispatch_error_tag</span><span class="p">,</span> <span class="n">cti</span><span class="o">::</span><span class="n">error_type</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// ...</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="c1">// Will receive errors and results</span>
<span class="n">continuable</span><span class="p">.</span><span class="n">next</span><span class="p">(</span><span class="n">my_callable</span><span class="p">{});</span></pre><aside class="m-note m-info"><h4>Note</h4><p>see continuable::next for details.</p></aside><aside class="m-note m-default"><h4>Since</h4><p>2.0.0</p></aside>
</div></section>
<section class="m-dox-details" id="ga7fcba5095c36f2577e1f4a2c5608dc6a"><div>
<h3>
using <a href="#ga7fcba5095c36f2577e1f4a2c5608dc6a" class="m-dox-self">error_type</a> = detail::types::error_type
</h3>
<p>Represents the type that is used as error type.</p>
<p>By default this type deduces to <code>std::exception_ptr</code>. If <code>CONTINUABLE_WITH_NO_EXCEPTIONS</code> is defined the type will be a <code>std::error_condition</code>. A custom error type may be set through defining <code>CONTINUABLE_WITH_CUSTOM_ERROR_TYPE</code>.</p><aside class="m-note m-default"><h4>Since</h4><p>2.0.0</p></aside>
</div></section>
<section class="m-dox-details" id="gabe4e73c301a2697d9252c400194474e0"><div>
<h3>
<div class="m-dox-template">
template&lt;typename T&gt;
</div>
using <a href="#gabe4e73c301a2697d9252c400194474e0" class="m-dox-self">is_continuable</a> = detail::base::is_continuable&lt;T&gt;
</h3>
<p>Deduces to a true_type if the given type is a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</p>
<aside class="m-note m-default"><h4>Since</h4><p>3.0.0</p></aside>
</div></section>
</section>
<section>
<h2>Function documentation</h2>
<section class="m-dox-details" id="gaf47869ea139d88976af5b9654d6d61c0"><div>
<h3>
<div class="m-dox-template">
template&lt;typename... Args, typename Continuation&gt;
</div>
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#gaf47869ea139d88976af5b9654d6d61c0" class="m-dox-self">make_continuable</a>(</span><span class="m-dox-wrap">Continuation&amp;&amp; continuation) <span class="m-label m-primary">constexpr</span></span></span>
</h3>
<p>Creates a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> from a promise/callback taking function.</p>
<table class="m-table m-fullwidth m-flat">
<thead>
<tr><th colspan="2">Template parameters</th></tr>
</thead>
<tbody>
<tr>
<td style="width: 1%">Args</td>
<td><p>The types (signature hint) the given promise is resolved with.</p><ul><li><p><strong>Some arguments</strong> indicate the types the promise will be invoked with.</p><pre class="m-code"><span class="k">auto</span> <span class="n">ct</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o">&lt;</span><span class="kt">int</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">([](</span><span class="k">auto</span><span class="o">&amp;&amp;</span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
<span class="n">promise</span><span class="p">.</span><span class="n">set_value</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span> <span class="s">&quot;&lt;html&gt;...&lt;/html&gt;&quot;</span><span class="p">);</span>
<span class="p">});</span></pre></li><li><p><code>void</code> <strong>as argument</strong> indicates that the promise will be invoked with no arguments:</p><pre class="m-code"><span class="k">auto</span> <span class="n">ct</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o">&lt;</span><span class="kt">void</span><span class="o">&gt;</span><span class="p">([](</span><span class="k">auto</span><span class="o">&amp;&amp;</span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
<span class="n">promise</span><span class="p">.</span><span class="n">set_value</span><span class="p">();</span>
<span class="p">});</span></pre></li><li><p><strong>No arguments</strong> Since version 3.0.0 make_continuable always requires to be given valid arguments! You should always give the type hint a callback is called with because it&#x27;s required for intermediate actions like connecting continuables. You may omit the signature hint if you are erasing the type of the continuable right after creation.</p><pre class="m-code"><span class="c1">// This won&#39;t work because the arguments are missing:</span>
<span class="k">auto</span> <span class="n">ct</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="p">([](</span><span class="k">auto</span><span class="o">&amp;&amp;</span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
<span class="n">promise</span><span class="p">.</span><span class="n">set_value</span><span class="p">(</span><span class="mf">0.f</span><span class="p">,</span> <span class="sc">&#39;c&#39;</span><span class="p">);</span>
<span class="p">});</span>
<span class="c1">// However, you are allowed to do this:</span>
<span class="n">cti</span><span class="o">::</span><span class="n">continuable</span><span class="o">&lt;</span><span class="kt">float</span><span class="p">,</span> <span class="kt">char</span><span class="o">&gt;</span> <span class="n">ct</span> <span class="o">=</span> <span class="p">[](</span><span class="k">auto</span><span class="o">&amp;&amp;</span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
<span class="n">promise</span><span class="p">.</span><span class="n">set_value</span><span class="p">(</span><span class="n">callback</span><span class="p">)(</span><span class="mf">0.f</span><span class="p">,</span> <span class="sc">&#39;c&#39;</span><span class="p">);</span>
<span class="p">};</span></pre></li></ul></td>
</tr>
<tr>
<td>Continuation</td>
<td></td>
</tr>
</tbody>
<thead>
<tr><th colspan="2">Parameters</th></tr>
</thead>
<tbody>
<tr>
<td>continuation</td>
<td><p>The continuation the continuable is created from. The continuation must be a callable type accepting a callback parameter which represents the object invokable with the asynchronous result of this continuable.</p><pre class="m-code"><span class="k">auto</span> <span class="n">ct</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">([](</span><span class="k">auto</span><span class="o">&amp;&amp;</span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
<span class="n">promise</span><span class="p">.</span><span class="n">set_value</span><span class="p">(</span><span class="s">&quot;result&quot;</span><span class="p">);</span>
<span class="p">});</span></pre><p>The callback may be stored or moved. In some cases the callback may be copied if supported by the underlying callback chain, in order to invoke the call chain multiple times. It&#x27;s recommended to accept any callback instead of erasing it.</p><pre class="m-code"><span class="c1">// Good practice:</span>
<span class="k">auto</span> <span class="n">ct</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">([](</span><span class="k">auto</span><span class="o">&amp;&amp;</span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
<span class="n">promise</span><span class="p">.</span><span class="n">set_value</span><span class="p">(</span><span class="s">&quot;result&quot;</span><span class="p">);</span>
<span class="p">});</span>
<span class="c1">// Good practice using a callable object:</span>
<span class="k">struct</span> <span class="n">Continuation</span> <span class="p">{</span>
<span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">T</span><span class="o">&gt;</span>
<span class="kt">void</span> <span class="k">operator</span><span class="p">()</span> <span class="p">(</span><span class="n">T</span><span class="o">&amp;&amp;</span> <span class="n">continuation</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="p">{</span>
<span class="c1">// ...</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="k">auto</span> <span class="n">ct</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">(</span><span class="n">Continuation</span><span class="p">{});</span>
<span class="c1">// Bad practice (because of unnecessary type erasure):</span>
<span class="k">auto</span> <span class="n">ct</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">(</span>
<span class="p">[](</span><span class="n">cti</span><span class="o">::</span><span class="n">promise</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
<span class="n">promise</span><span class="p">.</span><span class="n">set_value</span><span class="p">(</span><span class="s">&quot;result&quot;</span><span class="p">);</span>
<span class="p">});</span></pre></td>
</tr>
</tbody>
<tfoot>
<tr>
<th>Returns</th>
<td>A <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with unspecified template parameters which wraps the given continuation. In order to convert the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> to a known type you need to apply type erasure through the <a href="group___types.html#ga7c8df37fa79b1da94a876e8fc590783c" class="m-dox">continuable</a> or <a href="group___types.html#ga73e58e7558ecf3bd885cb2381160a582" class="m-dox">promise</a> facilities.</td>
</tr>
</tfoot>
</table>
<aside class="m-note m-info"><h4>Note</h4><p>You should always turn the callback/promise into a r-value if possible (<code>std::move</code> or <code>std::forward</code>) for qualifier correct invokation. Additionally it&#x27;s important to know that all continuable promises are callbacks and just expose their call operator nicely through <a href="classcti_1_1promise__base.html#a223d666944a70441b3837b461b1094c7" class="m-dox">set_<wbr />value</a> and <a href="classcti_1_1promise__base.html#a609a8cd2ccd43010b154ee0be6165be1" class="m-dox">set_<wbr />exception</a>.</p></aside><aside class="m-note m-default"><h4>Since</h4><p>1.0.0</p></aside>
</div></section>
<section class="m-dox-details" id="gaa638513fe4c0a80b9ad445f8dff91250"><div>
<h3>
<div class="m-dox-template">
template&lt;typename... Args&gt;
</div>
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#gaa638513fe4c0a80b9ad445f8dff91250" class="m-dox-self">make_ready_continuable</a>(</span><span class="m-dox-wrap">) <span class="m-label m-primary">constexpr</span></span></span>
</h3>
<p>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with no result which instantly resolves the promise with no values.</p>
<aside class="m-note m-warning"><h4>Attention</h4><p>Usually using this function isn&#x27;t needed at all since the continuable library is capable of working with plain values in most cases. Try not to use it since it causes unneccessary recursive function calls.</p></aside><aside class="m-note m-default"><h4>Since</h4><p>3.0.0</p></aside>
</div></section>
<section class="m-dox-details" id="gaad3c8cc144f08d8d3614651ae36f7106"><div>
<h3>
<div class="m-dox-template">
template&lt;typename Result&gt;
</div>
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#gaad3c8cc144f08d8d3614651ae36f7106" class="m-dox-self">make_ready_continuable</a>(</span><span class="m-dox-wrap">Result&amp;&amp; result) <span class="m-label m-primary">constexpr</span></span></span>
</h3>
<p>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with one result value which instantly resolves the promise with the given value.</p>
<aside class="m-note m-warning"><h4>Attention</h4><p>Usually using this function isn&#x27;t needed at all since the continuable library is capable of working with plain values in most cases. Try not to use it since it causes unneccessary recursive function calls.</p></aside><aside class="m-note m-default"><h4>Since</h4><p>3.0.0</p></aside>
</div></section>
<section class="m-dox-details" id="gade7f394af50a956c2516bffc29410a9d"><div>
<h3>
<div class="m-dox-template">
template&lt;typename FirstResult, typename SecondResult, typename... Rest&gt;
</div>
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#gade7f394af50a956c2516bffc29410a9d" class="m-dox-self">make_ready_continuable</a>(</span><span class="m-dox-wrap">FirstResult&amp;&amp; first_result,
SecondResult&amp;&amp; second_result,
Rest&amp;&amp;... rest) <span class="m-label m-primary">constexpr</span></span></span>
</h3>
<p>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with multiple result values which instantly resolves the promise with the given values.</p>
<aside class="m-note m-warning"><h4>Attention</h4><p>Usually using this function isn&#x27;t needed at all since the continuable library is capable of working with plain values in most cases. Try not to use it since it causes unneccessary recursive function calls.</p></aside><aside class="m-note m-default"><h4>Since</h4><p>3.0.0</p></aside>
</div></section>
<section class="m-dox-details" id="ga41794c321aef916f4fd0fe4c36aa9e6e"><div>
<h3>
<div class="m-dox-template">
template&lt;typename... Signature, typename Exception&gt;
</div>
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ga41794c321aef916f4fd0fe4c36aa9e6e" class="m-dox-self">make_exceptional_continuable</a>(</span><span class="m-dox-wrap">Exception&amp;&amp; exception) <span class="m-label m-primary">constexpr</span></span></span>
</h3>
<p>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with the parameterized result which instantly resolves the promise with the given error type.</p>
<table class="m-table m-fullwidth m-flat">
<thead>
<tr><th colspan="2">Template parameters</th></tr>
</thead>
<tbody>
<tr>
<td style="width: 1%">Signature</td>
<td>The fake signature of the returned continuable.</td>
</tr>
<tr>
<td>Exception</td>
<td></td>
</tr>
</tbody>
</table>
<p>See an example below:</p><pre class="m-code"><span class="n">std</span><span class="o">::</span><span class="n">logic_error</span> <span class="n">exception</span><span class="p">(</span><span class="s">&quot;Some issue!&quot;</span><span class="p">);</span>
<span class="k">auto</span> <span class="n">ptr</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">make_exception_ptr</span><span class="p">(</span><span class="n">exception</span><span class="p">);</span>
<span class="k">auto</span> <span class="n">ct</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_exceptional_continuable</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span><span class="p">(</span><span class="n">ptr</span><span class="p">);</span></pre><aside class="m-note m-default"><h4>Since</h4><p>3.0.0</p></aside>
</div></section>
</section>
</div>
</div>
</div>
</article></main>
<div class="m-dox-search" id="search">
<a href="#!" onclick="return hideSearch()"></a>
<div class="m-container">
<div class="m-row">
<div class="m-col-m-8 m-push-m-2">
<div class="m-dox-search-header m-text m-small">
<div><span class="m-label m-default">Tab</span> / <span class="m-label m-default">T</span> to search, <span class="m-label m-default">Esc</span> to close</div>
<div id="search-symbolcount">&hellip;</div>
</div>
<div class="m-dox-search-content">
<input type="search" id="search-input" placeholder="Loading &hellip;" disabled="disabled" autofocus="autofocus" />
<noscript class="m-text m-danger m-text-center">Unlike everything else in the docs, the search functionality <em>requires</em> JavaScript.</noscript>
<div id="search-help" class="m-text m-dim m-text-center">
Search for symbols, directories, files, pages or modules. You can omit any
prefix from the symbol or file path; adding a <code>:</code> or <code>/</code>
suffix lists all members of given symbol or directory. Navigate through the
list using <span class="m-label m-dim">&darr;</span> and
<span class="m-label m-dim">&uarr;</span>, press
<span class="m-label m-dim">Enter</span> to go.
</div>
<div id="search-notfound" class="m-text m-warning m-text-center">Sorry, nothing was found.</div>
<ul id="search-results"></ul>
</div>
</div>
</div>
</div>
</div>
<script src="search.js"></script>
<script src="searchdata.js" async="async"></script>
<footer><nav>
<div class="m-container">
<div class="m-row">
<div class="m-col-l-10 m-push-l-1">
<b><a href="https://github.com/Naios/continuable">continuable</a></b> - C++14 allocation aware futures</br>Copyright 2015&ndash;2018 <a href="https://github.com/Naios">Denis Blank</a>. Contact the author via <a href="mailto:denis.blank@outlook.com">e-mail</a>.</br>Powered by <a href="http://doxygen.org/">Doxygen</a> and <a href="http://mcss.mosra.cz/">m.css</a>
</div>
</div>
</div>
</nav></footer>
</body>
</html>