mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 16:56:44 +08:00
Publish
This commit is contained in:
commit
c349bf0e5b
181
annotated.html
Normal file
181
annotated.html
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
<!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>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">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>Classes</h2>
|
||||||
|
<ul class="m-dox">
|
||||||
|
<li class="m-dox-collapsible">
|
||||||
|
<a href="#" onclick="return toggle(this)">namespace</a> <a href="namespacecti.html" class="m-dox">cti</a> <span class="m-dox">Declares the continuable library namespace.</span>
|
||||||
|
<ul class="m-dox">
|
||||||
|
<li>namespace <a href="namespacecti_1_1transforms.html" class="m-dox">transforms</a> <span class="m-dox">The namespace transforms declares callable objects that transform any <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> to an object or to a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> itself.</span></li>
|
||||||
|
<li>class <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_base</a> <span class="m-dox">The main class of the continuable library, it provides the functionality for chaining callbacks and continuations together to a unified hierarchy.</span></li>
|
||||||
|
<li>class <a href="classcti_1_1continuable__trait.html" class="m-dox">continuable_trait</a> <span class="m-dox">Trait to retrieve a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> type with a given type-erasure backend.</span></li>
|
||||||
|
<li>class <a href="classcti_1_1promise__base.html" class="m-dox">promise_base</a> <span class="m-dox">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's result or through an error type.</span></li>
|
||||||
|
<li>class <a href="classcti_1_1promisify.html" class="m-dox">promisify</a> <span class="m-dox">Helper class for converting callback taking callable types into a a continuable. Various styles are supported.</span></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<script>
|
||||||
|
function toggle(e) {
|
||||||
|
e.parentElement.className = e.parentElement.className == 'm-dox-collapsible' ?
|
||||||
|
'm-dox-expansible' : 'm-dox-collapsible';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Collapse all nodes marked as such. Doing it via JS instead of directly in
|
||||||
|
markup so disabling it doesn't harm usability. The list is somehow
|
||||||
|
regenerated on every iteration and shrinks as I change the classes. It's not
|
||||||
|
documented anywhere and I'm not sure if this is the same across browsers, so
|
||||||
|
I am going backwards in that list to be sure. */
|
||||||
|
var collapsed = document.getElementsByClassName("collapsed");
|
||||||
|
for(var i = collapsed.length - 1; i >= 0; --i)
|
||||||
|
collapsed[i].className = 'm-dox-expansible';
|
||||||
|
</script>
|
||||||
|
</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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
96
atom-one-dark.css
Normal file
96
atom-one-dark.css
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Atom One Dark by Daniel Gamage
|
||||||
|
Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax
|
||||||
|
|
||||||
|
base: #282c34
|
||||||
|
mono-1: #abb2bf
|
||||||
|
mono-2: #818896
|
||||||
|
mono-3: #5c6370
|
||||||
|
hue-1: #56b6c2
|
||||||
|
hue-2: #61aeee
|
||||||
|
hue-3: #c678dd
|
||||||
|
hue-4: #98c379
|
||||||
|
hue-5: #e06c75
|
||||||
|
hue-5-2: #be5046
|
||||||
|
hue-6: #d19a66
|
||||||
|
hue-6-2: #e6c07b
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
.hljs {
|
||||||
|
display: block;
|
||||||
|
overflow-x: auto;
|
||||||
|
padding: 0.5em;
|
||||||
|
color: #abb2bf;
|
||||||
|
background: #282c34;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-comment,
|
||||||
|
.hljs-quote {
|
||||||
|
color: #5c6370;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-doctag,
|
||||||
|
.hljs-keyword,
|
||||||
|
.hljs-formula {
|
||||||
|
color: #c678dd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-section,
|
||||||
|
.hljs-name,
|
||||||
|
.hljs-selector-tag,
|
||||||
|
.hljs-deletion,
|
||||||
|
.hljs-subst {
|
||||||
|
color: #e06c75;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-literal {
|
||||||
|
color: #56b6c2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-string,
|
||||||
|
.hljs-regexp,
|
||||||
|
.hljs-addition,
|
||||||
|
.hljs-attribute,
|
||||||
|
.hljs-meta-string {
|
||||||
|
color: #98c379;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-built_in,
|
||||||
|
.hljs-class .hljs-title {
|
||||||
|
color: #e6c07b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-attr,
|
||||||
|
.hljs-variable,
|
||||||
|
.hljs-template-variable,
|
||||||
|
.hljs-type,
|
||||||
|
.hljs-selector-class,
|
||||||
|
.hljs-selector-attr,
|
||||||
|
.hljs-selector-pseudo,
|
||||||
|
.hljs-number {
|
||||||
|
color: #d19a66;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-symbol,
|
||||||
|
.hljs-bullet,
|
||||||
|
.hljs-link,
|
||||||
|
.hljs-meta,
|
||||||
|
.hljs-selector-id,
|
||||||
|
.hljs-title {
|
||||||
|
color: #61aeee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-emphasis {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-strong {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-link {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
BIN
bgnoise.png
Normal file
BIN
bgnoise.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
187
changelog.html
Normal file
187
changelog.html
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
<!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>Changelog | 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" id="m-navbar-current">Changelog</a></li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="modules.html">Modules</a>
|
||||||
|
<ol>
|
||||||
|
<li><a href="group___base.html">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>
|
||||||
|
Changelog
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p>A description of the changes made to continuable.</p>
|
||||||
|
<section id="changelog-versions"><h2><a href="#changelog-versions">Versions</a></h2><p>Following versions were released:</p><section id="changelog-versions-3-0-0"><h3><a href="#changelog-versions-3-0-0">3.0.0</a></h3><p><strong>New helper functions</strong></p><p>New helper functions were added to create ready continuables:</p><ul><li><a href="group___base.html#gaa638513fe4c0a80b9ad445f8dff91250" class="m-dox">make_<wbr />ready_<wbr />continuable</a></li><li><a href="group___base.html#ga41794c321aef916f4fd0fe4c36aa9e6e" class="m-dox">make_<wbr />exceptional_<wbr />continuable</a></li></ul><p><strong>Improvements to connections</strong></p><p>The implementation of connections were rewritten entirely. It is possible now to connect runtime sized containers as well as deeply nested sequences. See tutorial-connections for details.</p><p>Additionally connection overloads were added that accept two iterators in order to come closer to the interface of the standard library.</p><p>Also <a href="group___connections.html#ga4f6ecedf4b4ccd5e1c28d937ad717b32" class="m-dox">populate</a> was added which makes it possible to populate a dynamic container from <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects.</p><p><strong>Disabled copies for promises and continuables entirely</strong></p><p>The <a href="classcti_1_1promise__base.html" class="m-dox">promise_<wbr />base</a> and <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> is now non copyable. This change should make it easier to work with the move only semantic of continuables in order to make less mistakes.</p><p><strong>Traversal API</strong></p><p>A new traversal API for synchronous and asynchronous pack traversal was added which makes it easy to specify new connection types.</p></section><section id="changelog-versions-2-0-0"><h3><a href="#changelog-versions-2-0-0">2.0.0</a></h3><p><strong>Error handling</strong></p><p>Usually it is inconvenient to handle error codes and exceptions in an asynchronous context, as we all know <code>std::future</code> supports error handling through exceptions already. We now introduce this capability to the continuable library while allowing error codes to be used as well.</p><p>Consider the function <code><a href="group___types.html#ga7c8df37fa79b1da94a876e8fc590783c" class="m-dox">cti::<wbr />continuable</a><> get_bad_continuable()</code> which always resolves through an error, then you may handle the error code or exception as following:</p><pre class="m-code"><span class="n">get_bad_continuable</span><span class="p">()</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([]</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ... never invoked</span>
|
||||||
|
<span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([]</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ... never invoked as well</span>
|
||||||
|
<span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">fail</span><span class="p">([]</span> <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">exception_ptr</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">try</span> <span class="p">{</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">rethrow_exception</span><span class="p">(</span><span class="n">e</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">exception</span> <span class="k">const</span><span class="o">&</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Handle the exception here</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="p">});</span></pre><p><strong>Abstracting callbacks as promises</strong></p><p>Since a callback may be called through an error or result the cri::promise class was added in order ro provide a similar interface to std::promise:</p><pre class="m-code"><span class="k">auto</span> <span class="nf">http_request</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">url</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">return</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></span><span class="p">(</span>
|
||||||
|
<span class="p">[</span><span class="n">url</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">url</span><span class="p">)](</span><span class="n">cti</span><span class="o">::</span><span class="n">promise</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Perform the actual request through a different library,</span>
|
||||||
|
<span class="c1">// resolve the promise upon completion of the task.</span>
|
||||||
|
<span class="n">promise</span><span class="p">.</span><span class="n">set_value</span><span class="p">(</span><span class="s">"<html> ... </html>"</span><span class="p">);</span>
|
||||||
|
<span class="c1">// ...or promise.set_exception(...);</span>
|
||||||
|
<span class="p">});</span>
|
||||||
|
<span class="p">}</span></pre><p><strong><code>co_await</code> support</strong></p><p>Experimental coroutine (<code>co_await</code> and <code>co_return</code>) support was added, this is available on MSVC 2017 and Clang 5.0.</p><pre class="m-code"><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="n">co_await</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o"><</span><span class="kt">int</span><span class="o">></span><span class="p">([](</span><span class="k">auto</span><span class="o">&&</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">0</span><span class="p">);</span>
|
||||||
|
<span class="p">});</span></pre><p><strong>Minor improvements</strong></p><p>The library was improved in other ways:</p><ul><li><code>constexpr</code> and <code>noexcept</code> improvements</li><li>Compile-time improvements</li><li>Documentation improvements</li></ul><p><strong>Header split</strong></p><p>Since the overall library size was increased the headers were split into smaller chunks.</p></section><section id="changelog-versions-1-0-0"><h3><a href="#changelog-versions-1-0-0">1.0.0</a></h3><ul><li>Documentation and readme changes</li><li>Change the assertion type of some GTest macros from expected to assertion.</li></ul></section><section id="changelog-versions-0-8-0"><h3><a href="#changelog-versions-0-8-0">0.8.0 (unstable)</a></h3><ul><li>Fixes a major issue with handling the ownership for consumed continuables which led to unintended invocations.</li><li><p>Adds partial application support which makes it possible to chain callbacks which accept less arguments then the curret signature.</p><pre class="m-code"><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([]</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre></li><li><p>Adds Support for sequential invocation:</p><pre class="m-code"><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">>></span> <span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</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">github</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">atom</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre></li></ul></section><section id="changelog-versions-0-7-0"><h3><a href="#changelog-versions-0-7-0">0.7.0 (unstable)</a></h3><ul><li>Continuation syntactic sugar</li><li>Executor support</li><li>Connection support</li></ul></section></section><section id="changelog-semver"><h2><a href="#changelog-semver">Semantic versioning and stability</a></h2><p>Continuable strictly follows the rules of <a href="http://semver.org/">semantic versioning</a>, the API is kept stable across minor versions.</p><p>The CI driven unit-tests are observed through the Clang sanitizers (asan, ubsan and lsan - when compiling with Clang) or Valgrind (when compiling with GCC) in order to prevent regressions.</p></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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
842
classcti_1_1continuable__base.html
Normal file
842
classcti_1_1continuable__base.html
Normal file
@ -0,0 +1,842 @@
|
|||||||
|
<!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>cti::continuable_base class | 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">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" id="m-navbar-current">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>
|
||||||
|
<div class="m-dox-template">template<typename Data, typename Annotation></div>
|
||||||
|
<span class="m-breadcrumb"><a href="namespacecti.html">cti</a>::</span>continuable_base <span class="m-thin">class</span>
|
||||||
|
</h1>
|
||||||
|
<p>The main class of the continuable library, it provides the functionality for chaining callbacks and continuations together to a unified hierarchy.</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%">Data</td>
|
||||||
|
<td>The internal data which is used to store the current continuation and intermediate lazy connection result.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Annotation</td>
|
||||||
|
<td>The internal data used to store the current signature hint or strategy used for combining lazy connections.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
Reference
|
||||||
|
<ul>
|
||||||
|
<li><a href="#typeless-methods">Constructors, destructors, conversion operators</a></li>
|
||||||
|
<li><a href="#pub-methods">Public functions</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<p>The most important method is the <a href="classcti_1_1continuable__base.html#adf02030d7211ffc4610f3bcb13d2a149" class="m-dox">cti::<wbr />continuable_base::<wbr />then()</a> method, which allows to attach a callback to the continuable.</p><p>Use the continuable types defined in <code><a href="continuable_8hpp.html" class="m-dox">continuable/<wbr />continuable.hpp</a></code>, in order to use this class.</p><aside class="m-note m-info"><h4>Note</h4><p>Nearly all methods of the <a href="classcti_1_1continuable__base.html" class="m-dox">cti::<wbr />continuable_base</a> are required to be called as r-value. This is required because the continuable carries variables which are consumed when the object is transformed as part of a method call.</p></aside><aside class="m-note m-warning"><h4>Attention</h4><p>The <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects aren't intended to be stored. If you want to store a continuble_base you should always call the <a href="classcti_1_1continuable__base.html#a3c8d7fefc2f65fcd474c99d821809d24" class="m-dox">continuable_base::<wbr />freeze</a> method for disabling the invocation on destruction.</p></aside><aside class="m-note m-default"><h4>Since</h4><p>1.0.0</p></aside>
|
||||||
|
<section id="typeless-methods">
|
||||||
|
<h2><a href="#typeless-methods">Constructors, destructors, conversion operators</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper"><a href="#aaa60b403ed3408968d8ab37ef719e014" class="m-dox-self" name="aaa60b403ed3408968d8ab37ef719e014">continuable_base</a>(</span><span class="m-dox-wrap">Data data) <span class="m-label m-flat m-info">explicit</span> </span>
|
||||||
|
</dt>
|
||||||
|
<dd>Constructor accepting the data object while erasing the annotation.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename OData, std::enable_if_t<std::is_convertible<std::decay_t<OData>, Data>::value>* = nullptr></div>
|
||||||
|
<span class="m-dox-wrap-bumper"><a href="#a413696725b0ccbb504be13920f7ab127" class="m-dox-self" name="a413696725b0ccbb504be13920f7ab127">continuable_base</a>(</span><span class="m-dox-wrap">OData&& data)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Constructor accepting any object convertible to the data object, while erasing the annotation.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename OData, typename OAnnotation></div>
|
||||||
|
<span class="m-dox-wrap-bumper"><a href="#a8768c76d5d9bad19d820d9752faa337e" class="m-dox">continuable_base</a>(</span><span class="m-dox-wrap"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><OData, OAnnotation>&& other)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Constructor taking the data of other <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects while erasing the hint.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper"><a href="#ad52b8e48a62fa038d06faaca58295067" class="m-dox">~continuable_base</a>(</span><span class="m-dox-wrap">)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>The destructor automatically invokes the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> if it wasn't consumed yet.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section id="pub-methods">
|
||||||
|
<h2><a href="#pub-methods">Public functions</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename T, typename E = detail::types::this_thread_executor_tag></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#adf02030d7211ffc4610f3bcb13d2a149" class="m-dox">then</a>(</span><span class="m-dox-wrap">T&& callback,
|
||||||
|
E&& executor = detail::types::this_thread_executor_tag{}) && -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Main method of the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> to chain the current continuation with a new callback.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename OData, typename OAnnotation></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#a302341be87c7991b4409b743d0d14a9d" class="m-dox">then</a>(</span><span class="m-dox-wrap"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><OData, OAnnotation>&& continuation) && -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Additional overload of the <a href="classcti_1_1continuable__base.html#adf02030d7211ffc4610f3bcb13d2a149" class="m-dox">continuable_base::<wbr />then()</a> method which is accepting a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> itself.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename T, typename E = detail::types::this_thread_executor_tag></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#a7001122101ed32f729e39c53d6cb9c7f" class="m-dox">fail</a>(</span><span class="m-dox-wrap">T&& callback,
|
||||||
|
E&& executor = detail::types::this_thread_executor_tag{}) && -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Main method of the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> to catch exceptions and error codes in case the asynchronous control flow failed and was resolved through an error code or exception.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename OData, typename OAnnotation></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ac9da66a917e3d6901497d62eb67eaad0" class="m-dox">fail</a>(</span><span class="m-dox-wrap"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><OData, OAnnotation>&& continuation) && -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Additional overload of the <a href="classcti_1_1continuable__base.html#a7001122101ed32f729e39c53d6cb9c7f" class="m-dox">continuable_base::<wbr />fail()</a> method which is accepting a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> itself.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename T, typename E = detail::types::this_thread_executor_tag></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ad4960d0794abb800f1dfd9a668900149" class="m-dox">next</a>(</span><span class="m-dox-wrap">T&& callback,
|
||||||
|
E&& executor = detail::types::this_thread_executor_tag{}) && -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>A method which allows to use an overloaded callable for the error as well as the valid result path.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename T></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#abcf4cf105aa17826bcc3c2278f6ea1b5" class="m-dox">apply</a>(</span><span class="m-dox-wrap">T&& transform) && -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>A method which allows to apply this continuable to the given callable.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename T></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ae2d35537ea76f421ba4aed86dd849f98" class="m-dox">operator|</a>(</span><span class="m-dox-wrap">T&& right) && -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>The pipe operator | is an alias for the continuable::then method.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename T></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#a80027c1b07600076960ebcb87fd064c1" class="m-dox">operator|</a>(</span><span class="m-dox-wrap">detail::types::transform<T> transform) && -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>The pipe operator | is an alias for the continuable::apply method.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename OData, typename OAnnotation></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#a43ad4bfb19234a7856972d97337498db" class="m-dox">operator&&</a>(</span><span class="m-dox-wrap"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><OData, OAnnotation>&& right) && -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Invokes both <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects parallel and calls the callback with the result of both <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename OData, typename OAnnotation></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ada74584fb95bf00a50d05072e933c144" class="m-dox">operator||</a>(</span><span class="m-dox-wrap"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><OData, OAnnotation>&& right) && -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Invokes both <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects parallel and calls the callback once with the first result available.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename OData, typename OAnnotation></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#abaaaf8a35827456fead299851268760e" class="m-dox">operator>></a>(</span><span class="m-dox-wrap"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><OData, OAnnotation>&& right) && -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Invokes both <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects sequential and calls the callback with the result of both <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">void <a href="#a26ca692e597ebd8beff7d58d8bf584f4" class="m-dox">done</a>(</span><span class="m-dox-wrap">) &&</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Invokes the continuation chain manually even before the <a href="classcti_1_1continuable__base.html" class="m-dox">cti::<wbr />continuable_base</a> is destructed. This will release the object.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#a1bd6ce7c083af5faf4b241ada8d6f5f7" class="m-dox">is_frozen</a>(</span><span class="m-dox-wrap">) const -> bool <span class="m-label m-flat m-success">noexcept</span></span>
|
||||||
|
</dt>
|
||||||
|
<dd>Predicate to check whether the <a href="classcti_1_1continuable__base.html" class="m-dox">cti::<wbr />continuable_base</a> is frozen or not.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#a3c8d7fefc2f65fcd474c99d821809d24" class="m-dox">freeze</a>(</span><span class="m-dox-wrap">bool enabled = true) &noexcept -> <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>&</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Prevents the automatic invocation of the continuation chain which happens on destruction of the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>. You may still invoke the chain through the <a href="classcti_1_1continuable__base.html#a26ca692e597ebd8beff7d58d8bf584f4" class="m-dox">continuable_base::<wbr />done</a> method.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#a193e56e793fb40f56d6c6a942f605972" class="m-dox">freeze</a>(</span><span class="m-dox-wrap">bool enabled = true) &&noexcept -> <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>&&</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Prevents the automatic invocation of the continuation chain which happens on destruction of the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>. You may still invoke the chain through the <a href="classcti_1_1continuable__base.html#a26ca692e597ebd8beff7d58d8bf584f4" class="m-dox">continuable_base::<wbr />done</a> method.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ac79b103d5c000a3a3d1b98d8adcf58e8" class="m-dox">operator co_await</a>(</span><span class="m-dox-wrap">) && -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Implements the operator for awaiting on continuables using <code>co_await</code>.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<h2>Function documentation</h2>
|
||||||
|
<section class="m-dox-details" id="a8768c76d5d9bad19d820d9752faa337e"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
template<typename OData, typename OAnnotation>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper"> cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a8768c76d5d9bad19d820d9752faa337e" class="m-dox-self">continuable_base</a>(</span><span class="m-dox-wrap"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><OData, OAnnotation>&& other)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Constructor taking the data of other <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects while erasing the hint.</p>
|
||||||
|
<p>This constructor makes it possible to replace the internal data object of the continuable by any object which is useful for type-erasure.</p>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="ad52b8e48a62fa038d06faaca58295067"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper"> cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ad52b8e48a62fa038d06faaca58295067" class="m-dox-self">~continuable_base</a>(</span><span class="m-dox-wrap">)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>The destructor automatically invokes the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> if it wasn't consumed yet.</p>
|
||||||
|
<p>In order to invoke the continuable early you may call the <a href="classcti_1_1continuable__base.html#a26ca692e597ebd8beff7d58d8bf584f4" class="m-dox">continuable_base::<wbr />done()</a> method.</p><p>The <a href="classcti_1_1continuable__base.html#a3c8d7fefc2f65fcd474c99d821809d24" class="m-dox">continuable_base::<wbr />freeze</a> method disables the automatic invocation on destruction without invalidating the object.</p><aside class="m-note m-default"><h4>Since</h4><p>1.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="adf02030d7211ffc4610f3bcb13d2a149"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
template<typename T, typename E = detail::types::this_thread_executor_tag>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#adf02030d7211ffc4610f3bcb13d2a149" class="m-dox-self">then</a>(</span><span class="m-dox-wrap">T&& callback,
|
||||||
|
E&& executor = detail::types::this_thread_executor_tag{}) &&</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Main method of the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> to chain the current continuation with a new callback.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">callback</td>
|
||||||
|
<td><p>The callback which is used to process the current asynchronous result on arrival. The callback is required to accept the current result at least partially (or nothing of the result).</p><pre class="m-code"><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">&&</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">atom</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// We use the whole result</span>
|
||||||
|
<span class="p">});</span>
|
||||||
|
|
||||||
|
<span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">&&</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// We only use the result partially</span>
|
||||||
|
<span class="p">});</span>
|
||||||
|
|
||||||
|
<span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">&&</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([]</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// We discard the result</span>
|
||||||
|
<span class="p">});</span></pre></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>executor</td>
|
||||||
|
<td><p>The optional executor which is used to dispatch the callback. The executor needs to accept callable objects callable through an <code>operator()</code> through its operator() itself. The executor can be move-only, but it's not required to. The default executor which is used when omitting the argument dispatches the callback on the current executing thread. Consider the example shown below:</p><pre class="m-code"><span class="k">auto</span> <span class="n">executor</span> <span class="o">=</span> <span class="p">[](</span><span class="k">auto</span><span class="o">&&</span> <span class="n">work</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Dispatch the work here or forward it to an executor of</span>
|
||||||
|
<span class="c1">// your choice.</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">forward</span><span class="o"><</span><span class="k">decltype</span><span class="p">(</span><span class="n">work</span><span class="p">)</span><span class="o">></span><span class="p">(</span><span class="n">work</span><span class="p">)();</span>
|
||||||
|
<span class="p">};</span>
|
||||||
|
|
||||||
|
<span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Do something...</span>
|
||||||
|
<span class="p">},</span> <span class="n">executor</span><span class="p">);</span></pre></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Returns</th>
|
||||||
|
<td><p>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with an asynchronous return type depending on the return value of the callback:</p><table class="m-table"><thead><tr><th>Callback returns</th><th>Resulting type</th></tr></thead><tbody><tr><td><code>void</code></td><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <></code></td></tr><tr><td><code>Arg</code></td><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <Arg></code></td></tr><tr><td><code>std::pair<First, Second></code></td><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <First, Second></code></td></tr><tr><td><code>std::tuple<Args...></code></td><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <Args...></code></td></tr><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><Arg...></code></td><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <Args...></code></td></tr></tbody></table><p>Which means the result type of the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> is equal to the plain types the callback returns (<code>std::tuple</code> and <code>std::pair</code> arguments are unwrapped). A single <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> as argument is resolved and the result type is equal to the resolved <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>. Consider the following examples:</p><pre class="m-code"><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span><span class="p">;</span> <span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([]</span> <span class="p">{</span> <span class="p">});</span> <span class="c1">// <void></span>
|
||||||
|
|
||||||
|
<span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="mi">0</span><span class="p">;</span> <span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="kt">int</span> <span class="n">a</span><span class="p">)</span> <span class="p">{</span> <span class="p">});</span> <span class="c1">// <int></span>
|
||||||
|
|
||||||
|
<span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">make_pair</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span> <span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="kt">int</span> <span class="n">a</span><span class="p">,</span> <span class="kt">int</span> <span class="n">b</span><span class="p">)</span> <span class="p">{</span> <span class="p">});</span> <span class="c1">// <int, int></span>
|
||||||
|
|
||||||
|
<span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">);</span> <span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="kt">int</span> <span class="n">a</span><span class="p">,</span> <span class="kt">int</span> <span class="n">b</span><span class="p">,</span> <span class="kt">int</span> <span class="n">c</span><span class="p">)</span> <span class="p">{</span> <span class="p">});</span> <span class="c1">// <int, int, int></span>
|
||||||
|
|
||||||
|
<span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">);</span> <span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">atom</span><span class="p">)</span> <span class="p">{</span> <span class="p">});</span> <span class="c1">// <std::string></span></pre></td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>1.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="a302341be87c7991b4409b743d0d14a9d"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
template<typename OData, typename OAnnotation>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a302341be87c7991b4409b743d0d14a9d" class="m-dox-self">then</a>(</span><span class="m-dox-wrap"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><OData, OAnnotation>&& continuation) &&</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Additional overload of the <a href="classcti_1_1continuable__base.html#adf02030d7211ffc4610f3bcb13d2a149" class="m-dox">continuable_base::<wbr />then()</a> method which is accepting a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> itself.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">continuation</td>
|
||||||
|
<td><p>A <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> reflecting the continuation which is used to continue the call hierarchy. The result of the current continuable is discarded and the given continuation is invoked as shown below.</p><pre class="m-code"><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">atom</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Returns</th>
|
||||||
|
<td>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> representing the next asynchronous result to continue within the asynchronous call hierarchy.</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>1.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="a7001122101ed32f729e39c53d6cb9c7f"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
template<typename T, typename E = detail::types::this_thread_executor_tag>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a7001122101ed32f729e39c53d6cb9c7f" class="m-dox-self">fail</a>(</span><span class="m-dox-wrap">T&& callback,
|
||||||
|
E&& executor = detail::types::this_thread_executor_tag{}) &&</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Main method of the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> to catch exceptions and error codes in case the asynchronous control flow failed and was resolved through an error code or exception.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">callback</td>
|
||||||
|
<td>The callback which is used to process the current asynchronous error result on arrival. In case the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> is using exceptions, the usage is as shown below:</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>executor</td>
|
||||||
|
<td>The optional executor which is used to dispatch the callback. See the description in <code>then</code> above.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Returns</th>
|
||||||
|
<td>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with an asynchronous return type depending on the previous result type.</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<pre class="m-code"><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">)</span> <span class="p">{</span> <span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">fail</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">exception_ptr</span> <span class="n">ptr</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Handle the error here</span>
|
||||||
|
<span class="k">try</span> <span class="p">{</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">rethrow_exception</span><span class="p">(</span><span class="n">ptr</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="o">&</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="n">e</span><span class="p">.</span><span class="n">what</span><span class="p">();</span> <span class="c1">// Handle the exception</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="p">});</span></pre><p>In case exceptions are disabled, <code>std::error_condition</code> is used as error result instead of <code>std::exception_ptr</code>.</p><pre class="m-code"><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">)</span> <span class="p">{</span> <span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">fail</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">error_condition</span> <span class="n">error</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="n">error</span><span class="p">.</span><span class="n">message</span><span class="p">();</span> <span class="c1">// Handle the error here</span>
|
||||||
|
<span class="p">});</span></pre><aside class="m-note m-default"><h4>Since</h4><p>2.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="ac9da66a917e3d6901497d62eb67eaad0"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
template<typename OData, typename OAnnotation>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ac9da66a917e3d6901497d62eb67eaad0" class="m-dox-self">fail</a>(</span><span class="m-dox-wrap"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><OData, OAnnotation>&& continuation) &&</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Additional overload of the <a href="classcti_1_1continuable__base.html#a7001122101ed32f729e39c53d6cb9c7f" class="m-dox">continuable_base::<wbr />fail()</a> method which is accepting a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> itself.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">continuation</td>
|
||||||
|
<td><p>A <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> reflecting the continuation which is used to continue the call hierarchy on errors. The result of the current continuable is discarded and the given continuation is invoked as shown below.</p><pre class="m-code"><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">fail</span><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">))</span></pre></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Returns</th>
|
||||||
|
<td>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with an asynchronous return type depending on the previous result type.</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>2.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="ad4960d0794abb800f1dfd9a668900149"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
template<typename T, typename E = detail::types::this_thread_executor_tag>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ad4960d0794abb800f1dfd9a668900149" class="m-dox-self">next</a>(</span><span class="m-dox-wrap">T&& callback,
|
||||||
|
E&& executor = detail::types::this_thread_executor_tag{}) &&</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>A method which allows to use an overloaded callable for the error as well as the valid result path.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">callback</td>
|
||||||
|
<td>The callback which is used to process the current asynchronous result and error on arrival.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>executor</td>
|
||||||
|
<td>The optional executor which is used to dispatch the callback. See the description in <code>then</code> above.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Returns</th>
|
||||||
|
<td>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with an asynchronous return type depending on the current result type.</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<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="c1">// Will receive errors and results</span>
|
||||||
|
<span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</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-default"><h4>Since</h4><p>2.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="abcf4cf105aa17826bcc3c2278f6ea1b5"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
template<typename T>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#abcf4cf105aa17826bcc3c2278f6ea1b5" class="m-dox-self">apply</a>(</span><span class="m-dox-wrap">T&& transform) &&</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>A method which allows to apply this continuable to the given callable.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">transform</td>
|
||||||
|
<td>A transform which shall accept this continuable</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Returns</th>
|
||||||
|
<td>Returns the result of the given transform when this continuable is passed into it.</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>2.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="ae2d35537ea76f421ba4aed86dd849f98"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
template<typename T>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ae2d35537ea76f421ba4aed86dd849f98" class="m-dox-self">operator|</a>(</span><span class="m-dox-wrap">T&& right) &&</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>The pipe operator | is an alias for the continuable::then method.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">right</td>
|
||||||
|
<td>The argument on the right-hand side to connect.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Returns</th>
|
||||||
|
<td>See the corresponding <a href="classcti_1_1continuable__base.html#adf02030d7211ffc4610f3bcb13d2a149" class="m-dox">continuable_base::<wbr />then</a> method for the explanation of the return type.</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>2.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="a80027c1b07600076960ebcb87fd064c1"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
template<typename T>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a80027c1b07600076960ebcb87fd064c1" class="m-dox-self">operator|</a>(</span><span class="m-dox-wrap">detail::types::transform<T> transform) &&</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>The pipe operator | is an alias for the continuable::apply method.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">transform</td>
|
||||||
|
<td>The transformer which is applied.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Returns</th>
|
||||||
|
<td>See the corresponding <a href="classcti_1_1continuable__base.html#abcf4cf105aa17826bcc3c2278f6ea1b5" class="m-dox">continuable_base::<wbr />apply</a> method for the explanation of the return type.</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-info"><h4>Note</h4><p>You may create your own transformation through calling make_transformation.</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="a43ad4bfb19234a7856972d97337498db"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
template<typename OData, typename OAnnotation>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a43ad4bfb19234a7856972d97337498db" class="m-dox-self">operator&&</a>(</span><span class="m-dox-wrap"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><OData, OAnnotation>&& right) &&</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Invokes both <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects parallel and calls the callback with the result of both <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">right</td>
|
||||||
|
<td>The continuable on the right-hand side to connect.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Returns</th>
|
||||||
|
<td><p>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with a result type matching the result of the left <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> combined with the right <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>. The returned <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> will be in an intermediate lazy state, further calls to its <a href="classcti_1_1continuable__base.html#a43ad4bfb19234a7856972d97337498db" class="m-dox">continuable_base::<wbr />operator &&</a> will add other <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects to the current invocation chain.</p><pre class="m-code"><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">&&</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">atom</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span>
|
||||||
|
|
||||||
|
<span class="k">auto</span> <span class="n">request</span> <span class="o">=</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">&&</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">);</span>
|
||||||
|
<span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">request</span><span class="p">)</span> <span class="o">&&</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"travis-ci.org"</span><span class="p">))</span>
|
||||||
|
<span class="c1">// All three requests are invoked in parallel although we added</span>
|
||||||
|
<span class="c1">// the request to "travis-ci.org" last.</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">atom</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">travis</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre></td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-info"><h4>Note</h4><p>The <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects are invoked all at onve, because the <code>all</code> strategy tries to resolve the continuations as fast as possible. Sequential invocation is also supported through the <a href="classcti_1_1continuable__base.html#abaaaf8a35827456fead299851268760e" class="m-dox">continuable_base::<wbr />operator>></a> method.</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="ada74584fb95bf00a50d05072e933c144"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
template<typename OData, typename OAnnotation>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ada74584fb95bf00a50d05072e933c144" class="m-dox-self">operator||</a>(</span><span class="m-dox-wrap"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><OData, OAnnotation>&& right) &&</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Invokes both <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects parallel and calls the callback once with the first result available.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">right</td>
|
||||||
|
<td>The continuable on the right-hand side to connect. The right continuable is required to have the same result as the left connected <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Returns</th>
|
||||||
|
<td><p>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with a result type matching the combined result which of all connected <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects. The returned <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> will be in an intermediate lazy state, further calls to its <a href="classcti_1_1continuable__base.html#ada74584fb95bf00a50d05072e933c144" class="m-dox">continuable_base::<wbr />operator ||</a> will add other <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects to the current invocation chain.</p><pre class="m-code"><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">||</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github_or_atom</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span>
|
||||||
|
|
||||||
|
<span class="p">(</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="sc">'A'</span><span class="p">)</span> <span class="o">||</span> <span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">29</span><span class="p">,</span> <span class="sc">'B'</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="kt">int</span> <span class="n">a</span><span class="p">,</span> <span class="kt">char</span> <span class="n">b</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre></td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-info"><h4>Note</h4><p>The <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects are invoked all at once, however, the callback is only called once with the first result or exception which becomes available.</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="abaaaf8a35827456fead299851268760e"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
template<typename OData, typename OAnnotation>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#abaaaf8a35827456fead299851268760e" class="m-dox-self">operator>></a>(</span><span class="m-dox-wrap"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><OData, OAnnotation>&& right) &&</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Invokes both <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects sequential and calls the callback with the result of both <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">right</td>
|
||||||
|
<td>The continuable on the right-hand side to connect.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Returns</th>
|
||||||
|
<td><p>Returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with a result type matching the result of the left <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> combined with the right <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</p><pre class="m-code"><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">>></span> <span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">atom</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// The callback is called with the result of both requests,</span>
|
||||||
|
<span class="c1">// however, the request to atom was started after the request</span>
|
||||||
|
<span class="c1">// to github was finished.</span>
|
||||||
|
<span class="p">});</span></pre></td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-info"><h4>Note</h4><p>The <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects are invoked sequential one after the previous one was finished. Parallel invocation is also supported through the <a href="classcti_1_1continuable__base.html#a43ad4bfb19234a7856972d97337498db" class="m-dox">continuable_base::<wbr />operator &&</a> method.</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="a26ca692e597ebd8beff7d58d8bf584f4"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">void cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a26ca692e597ebd8beff7d58d8bf584f4" class="m-dox-self">done</a>(</span><span class="m-dox-wrap">) &&</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Invokes the continuation chain manually even before the <a href="classcti_1_1continuable__base.html" class="m-dox">cti::<wbr />continuable_base</a> is destructed. This will release the object.</p>
|
||||||
|
<aside class="m-note m-default"><h4>See also</h4><p><a href="classcti_1_1continuable__base.html#ad52b8e48a62fa038d06faaca58295067" class="m-dox">continuable_base::<wbr />~continuable_base()</a> for further details about the continuation invocation on destruction.</p></aside><aside class="m-note m-warning"><h4>Attention</h4><p>This method will trigger an assertion if the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> was released already.</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="a1bd6ce7c083af5faf4b241ada8d6f5f7"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">bool cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a1bd6ce7c083af5faf4b241ada8d6f5f7" class="m-dox-self">is_frozen</a>(</span><span class="m-dox-wrap">) const <span class="m-label m-success">noexcept</span></span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Predicate to check whether the <a href="classcti_1_1continuable__base.html" class="m-dox">cti::<wbr />continuable_base</a> is frozen or not.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 1%">Returns</th>
|
||||||
|
<td>Returns true when the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> is frozen.</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-default"><h4>See also</h4><p><a href="classcti_1_1continuable__base.html#a3c8d7fefc2f65fcd474c99d821809d24" class="m-dox">continuable_base::<wbr />freeze</a> for further details.</p></aside><aside class="m-note m-warning"><h4>Attention</h4><p>This method will trigger an assertion if the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> was released already.</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="a3c8d7fefc2f65fcd474c99d821809d24"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>& cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a3c8d7fefc2f65fcd474c99d821809d24" class="m-dox-self">freeze</a>(</span><span class="m-dox-wrap">bool enabled = true) &noexcept</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Prevents the automatic invocation of the continuation chain which happens on destruction of the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>. You may still invoke the chain through the <a href="classcti_1_1continuable__base.html#a26ca692e597ebd8beff7d58d8bf584f4" class="m-dox">continuable_base::<wbr />done</a> method.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">enabled</td>
|
||||||
|
<td>Indicates whether the freeze is enabled or disabled.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>This is useful for storing a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> inside a continuation chain while storing it for further usage.</p><aside class="m-note m-default"><h4>See also</h4><p><a href="classcti_1_1continuable__base.html#ad52b8e48a62fa038d06faaca58295067" class="m-dox">continuable_base::<wbr />~continuable_base()</a> for further details about the continuation invocation on destruction.</p></aside><aside class="m-note m-warning"><h4>Attention</h4><p>This method will trigger an assertion if the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> was released already.</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="a193e56e793fb40f56d6c6a942f605972"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper"><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>&& cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a193e56e793fb40f56d6c6a942f605972" class="m-dox-self">freeze</a>(</span><span class="m-dox-wrap">bool enabled = true) &&noexcept</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Prevents the automatic invocation of the continuation chain which happens on destruction of the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>. You may still invoke the chain through the <a href="classcti_1_1continuable__base.html#a26ca692e597ebd8beff7d58d8bf584f4" class="m-dox">continuable_base::<wbr />done</a> method.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">enabled</td>
|
||||||
|
<td>Indicates whether the freeze is enabled or disabled.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>This is useful for storing a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> inside a continuation chain while storing it for further usage.</p><aside class="m-note m-default"><h4>See also</h4><p><a href="classcti_1_1continuable__base.html#ad52b8e48a62fa038d06faaca58295067" class="m-dox">continuable_base::<wbr />~continuable_base()</a> for further details about the continuation invocation on destruction.</p></aside><aside class="m-note m-warning"><h4>Attention</h4><p>This method will trigger an assertion if the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> was released already.</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="ac79b103d5c000a3a3d1b98d8adcf58e8"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Annotation>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto cti::<wbr />continuable_base<Data, Annotation>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ac79b103d5c000a3a3d1b98d8adcf58e8" class="m-dox-self">operator co_await</a>(</span><span class="m-dox-wrap">) &&</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Implements the operator for awaiting on continuables using <code>co_await</code>.</p>
|
||||||
|
<p>The operator is only enabled if <code>CONTINUABLE_HAS_EXPERIMENTAL_COROUTINE</code> is defined and the toolchain supports experimental coroutines.</p><p>The return type of the <code>co_await</code> expression is specified as following:</p><table class="m-table"><thead><tr><th>Continuation type</th><th>co_await returns</th></tr></thead><tbody><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <></code></td><td><code>void</code></td></tr><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <Arg></code></td><td><code>Arg</code></td></tr><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <Args...></code></td><td><code>std::tuple<Args...></code></td></tr></tbody></table><p>When exceptions are used the usage is as intuitive as shown below:</p><pre class="m-code"><span class="c1">// Handling the exception isn't required and</span>
|
||||||
|
<span class="c1">// the try catch clause may be omitted.</span>
|
||||||
|
<span class="k">try</span> <span class="p">{</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">response</span> <span class="o">=</span> <span class="n">co_await</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="o">&</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="n">e</span><span class="p">.</span><span class="n">what</span><span class="p">();</span>
|
||||||
|
<span class="p">}</span></pre><p>In case the library is configured to use error codes or a custom error type the return type of the co_await expression is changed. The result is returned through an internal proxy object which may be queried for the error object.</p><table class="m-table"><thead><tr><th>Continuation type</th><th>co_await returns</th></tr></thead><tbody><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <></code></td><td><code>unspecified<void></code></td></tr><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <Arg></code></td><td><code>unspecified<Arg></code></td></tr><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <Args...></code></td><td><code>unspecified<std::tuple<Args...>></code></td></tr></tbody></table><p>The interface of the proxy object is similar to the one proposed in the <code>std::expected</code> proposal:</p><pre class="m-code"><span class="k">if</span> <span class="p">(</span><span class="k">auto</span><span class="o">&&</span> <span class="n">result</span> <span class="o">=</span> <span class="n">co_await</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">))</span> <span class="p">{</span>
|
||||||
|
<span class="k">auto</span> <span class="n">value</span> <span class="o">=</span> <span class="o">*</span><span class="n">result</span><span class="p">;</span>
|
||||||
|
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">error_type</span> <span class="n">error</span> <span class="o">=</span> <span class="n">result</span><span class="p">.</span><span class="n">get_exception</span><span class="p">();</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">co_await</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">);</span>
|
||||||
|
<span class="kt">bool</span><span class="p">(</span><span class="n">result</span><span class="p">);</span>
|
||||||
|
<span class="n">result</span><span class="p">.</span><span class="n">is_value</span><span class="p">();</span>
|
||||||
|
<span class="n">result</span><span class="p">.</span><span class="n">is_exception</span><span class="p">();</span>
|
||||||
|
<span class="o">*</span><span class="n">result</span><span class="p">;</span> <span class="c1">// Same as result.get_value()</span>
|
||||||
|
<span class="n">result</span><span class="p">.</span><span class="n">get_value</span><span class="p">();</span>
|
||||||
|
<span class="n">result</span><span class="p">.</span><span class="n">get_exception</span><span class="p">();</span></pre><aside class="m-note m-info"><h4>Note</h4><p>Using <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> as return type for coroutines is supported. The coroutine is initially stopped and resumed when the continuation is requested in order to keep the lazy evaluation semantics of the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</p><pre class="m-code"><span class="n">cti</span><span class="o">::</span><span class="n">continuable</span><span class="o"><></span> <span class="n">resolve_async_void</span><span class="p">()</span> <span class="p">{</span>
|
||||||
|
<span class="n">co_await</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">);</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="n">co_return</span><span class="p">;</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">continuable</span><span class="o"><</span><span class="kt">int</span><span class="o">></span> <span class="n">resolve_async</span><span class="p">()</span> <span class="p">{</span>
|
||||||
|
<span class="n">co_await</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">);</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="n">co_return</span> <span class="mi">0</span><span class="p">;</span>
|
||||||
|
<span class="p">}</span></pre><p>It's possible to return multiple return values from coroutines by wrapping those in a tuple like type:</p><pre class="m-code"><span class="n">cti</span><span class="o">::</span><span class="n">continuable</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="o">></span> <span class="n">resolve_async_multiple</span><span class="p">()</span> <span class="p">{</span>
|
||||||
|
<span class="n">co_await</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">);</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="n">co_return</span> <span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span></pre></aside><aside class="m-note m-default"><h4>Since</h4><p>2.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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
201
classcti_1_1continuable__trait.html
Normal file
201
classcti_1_1continuable__trait.html
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
<!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>cti::continuable_trait class | 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">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>
|
||||||
|
<div class="m-dox-template">template<template<std::size_t, typename...> class CallbackWrapper, template<std::size_t, typename...> class ContinuationWrapper, typename... Args></div>
|
||||||
|
<span class="m-breadcrumb"><a href="namespacecti.html">cti</a>::</span>continuable_trait <span class="m-thin">class</span>
|
||||||
|
</h1>
|
||||||
|
<p>Trait to retrieve a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> type with a given type-erasure backend.</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%">CallbackWrapper</td>
|
||||||
|
<td>The type which is used to erase the callback.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>ContinuationWrapper</td>
|
||||||
|
<td>The type which is used to erase the continuation data.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Args</td>
|
||||||
|
<td>The current signature of the continuable.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
Reference
|
||||||
|
<ul>
|
||||||
|
<li><a href="#pub-types">Public types</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<p>Every object may me used as type-erasure backend as long as the requirements of a <code>std::function</code> like wrapper are satisfied.</p>
|
||||||
|
<section id="pub-types">
|
||||||
|
<h2><a href="#pub-types">Public types</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
using <a href="#a6ca46b60fcadd93508f4fa47a7371c00" class="m-dox-self" name="a6ca46b60fcadd93508f4fa47a7371c00">promise</a> = <a href="classcti_1_1promise__base.html" class="m-dox">promise_<wbr />base</a><callback, detail::hints::signature_hint_tag<Args...>>
|
||||||
|
</dt>
|
||||||
|
<dd>The promise type which is used to resolve continuations.</dd>
|
||||||
|
<dt>
|
||||||
|
using <a href="#a7d15d431d3c9b6227a0c181b60f3db55" class="m-dox-self" name="a7d15d431d3c9b6227a0c181b60f3db55">continuable</a> = <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a><ContinuationWrapper<sizeof(callback), void(<a href="classcti_1_1continuable__trait.html#a6ca46b60fcadd93508f4fa47a7371c00" class="m-dox">promise</a>)>, detail::hints::signature_hint_tag<Args...>>
|
||||||
|
</dt>
|
||||||
|
<dd>The continuable type for the given parameters.</dd>
|
||||||
|
</dl>
|
||||||
|
</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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
250
classcti_1_1promise__base.html
Normal file
250
classcti_1_1promise__base.html
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
<!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>cti::promise_base class | 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">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" id="m-navbar-current">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>
|
||||||
|
<div class="m-dox-template">template<typename Data, typename Hint></div>
|
||||||
|
<span class="m-breadcrumb"><a href="namespacecti.html">cti</a>::</span>promise_base <span class="m-thin">class</span>
|
||||||
|
</h1>
|
||||||
|
<p>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's result or through an error type.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
Reference
|
||||||
|
<ul>
|
||||||
|
<li><a href="#typeless-methods">Constructors, destructors, conversion operators</a></li>
|
||||||
|
<li><a href="#pub-methods">Public functions</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<p>Use the promise type defined in <code>continuable/continuable_types.hpp</code>, in order to use this class.</p><p>If we want to resolve the <a href="classcti_1_1promise__base.html" class="m-dox">promise_<wbr />base</a> trough the call operator, and we want to resolve it through an exception, we must call it with a dispatch_error_tag as first and the exception as second argument. Additionally the promise is resolveable only through its call operator when invoked as an r-value.</p><aside class="m-note m-default"><h4>Since</h4><p>2.0.0</p></aside>
|
||||||
|
<section id="typeless-methods">
|
||||||
|
<h2><a href="#typeless-methods">Constructors, destructors, conversion operators</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper"><a href="#aef8b6fbfcc15572b829770f28324e4f0" class="m-dox-self" name="aef8b6fbfcc15572b829770f28324e4f0">promise_base</a>(</span><span class="m-dox-wrap">Data data) <span class="m-label m-flat m-info">explicit</span> </span>
|
||||||
|
</dt>
|
||||||
|
<dd>Constructor accepting the data object.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename OData, std::enable_if_t<std::is_convertible<std::decay_t<OData>, Data>::value>* = nullptr></div>
|
||||||
|
<span class="m-dox-wrap-bumper"><a href="#aa3fd45949359892e71aa0b10cf9fa1f5" class="m-dox-self" name="aa3fd45949359892e71aa0b10cf9fa1f5">promise_base</a>(</span><span class="m-dox-wrap">OData&& data)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Constructor accepting any object convertible to the data object.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section id="pub-methods">
|
||||||
|
<h2><a href="#pub-methods">Public functions</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">void <a href="#a87d5dfa33e141e08abef9f2a83f87c78" class="m-dox">operator()</a>(</span><span class="m-dox-wrap">Args... args) &&noexcept</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Resolves the continuation with the given values.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">void <a href="#a85c7f9a497ee8cf4d42414f94c106aa3" class="m-dox">operator()</a>(</span><span class="m-dox-wrap">detail::types::dispatch_error_tag tag,
|
||||||
|
detail::types::error_type exception) &&noexcept</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Resolves the continuation with the given exception.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">void <a href="#a223d666944a70441b3837b461b1094c7" class="m-dox">set_value</a>(</span><span class="m-dox-wrap">Args... args) <span class="m-label m-flat m-success">noexcept</span></span>
|
||||||
|
</dt>
|
||||||
|
<dd>Resolves the continuation with the given values.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">void <a href="#a609a8cd2ccd43010b154ee0be6165be1" class="m-dox">set_exception</a>(</span><span class="m-dox-wrap">detail::types::error_type exception) <span class="m-label m-flat m-success">noexcept</span></span>
|
||||||
|
</dt>
|
||||||
|
<dd>Resolves the continuation with the given exception.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<h2>Function documentation</h2>
|
||||||
|
<section class="m-dox-details" id="a87d5dfa33e141e08abef9f2a83f87c78"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Hint>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">void cti::<wbr />promise_base<Data, Hint>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a87d5dfa33e141e08abef9f2a83f87c78" class="m-dox-self">operator()</a>(</span><span class="m-dox-wrap">Args... args) &&noexcept</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Resolves the continuation with the given values.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>2.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="a85c7f9a497ee8cf4d42414f94c106aa3"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Hint>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">void cti::<wbr />promise_base<Data, Hint>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a85c7f9a497ee8cf4d42414f94c106aa3" class="m-dox-self">operator()</a>(</span><span class="m-dox-wrap">detail::types::dispatch_error_tag tag,
|
||||||
|
detail::types::error_type exception) &&noexcept</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Resolves the continuation with the given exception.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>2.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="a223d666944a70441b3837b461b1094c7"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Hint>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">void cti::<wbr />promise_base<Data, Hint>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a223d666944a70441b3837b461b1094c7" class="m-dox-self">set_value</a>(</span><span class="m-dox-wrap">Args... args) <span class="m-label m-success">noexcept</span></span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Resolves the continuation with the given values.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>2.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="a609a8cd2ccd43010b154ee0be6165be1"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Data, typename Hint>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">void cti::<wbr />promise_base<Data, Hint>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a609a8cd2ccd43010b154ee0be6165be1" class="m-dox-self">set_exception</a>(</span><span class="m-dox-wrap">detail::types::error_type exception) <span class="m-label m-success">noexcept</span></span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Resolves the continuation with the given exception.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>2.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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
245
classcti_1_1promisify.html
Normal file
245
classcti_1_1promisify.html
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
<!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>cti::promisify class | 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">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>
|
||||||
|
<div class="m-dox-template">template<typename... Result></div>
|
||||||
|
<span class="m-breadcrumb"><a href="namespacecti.html">cti</a>::</span>promisify <span class="m-thin">class</span>
|
||||||
|
</h1>
|
||||||
|
<p>Helper class for converting callback taking callable types into a a continuable. Various styles are supported.</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%">Result</td>
|
||||||
|
<td>The result of the converted continuable, this should align with the arguments that are passed to the callback.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
Reference
|
||||||
|
<ul>
|
||||||
|
<li><a href="#pub-static-methods">Public static functions</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<ul><li><code>from</code>: Converts callback taking callable types into continuables which pass an error code as first parameter and the rest of the result afterwards.</li></ul><aside class="m-note m-default"><h4>Since</h4><p>3.0.0</p></aside>
|
||||||
|
<section id="pub-static-methods">
|
||||||
|
<h2><a href="#pub-static-methods">Public static functions</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Callable, typename... Args></div>
|
||||||
|
<span class="m-dox-wrap-bumper">static auto <a href="#a28834d45efa0e6d2e22771cdd38e33a4" class="m-dox">from</a>(</span><span class="m-dox-wrap">Callable&& callable,
|
||||||
|
Args&&... args) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Converts callback taking callable types into a continuable. This applies to calls which pass an error code as first parameter and the rest of the asynchronous result afterwards.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Resolver, typename Callable, typename... Args></div>
|
||||||
|
<span class="m-dox-wrap-bumper">static auto <a href="#a544cd0fd6e3466b9c3c45079803d6b84" class="m-dox">with</a>(</span><span class="m-dox-wrap">Resolver&& resolver,
|
||||||
|
Callable&& callable,
|
||||||
|
Args&&... args) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Converts callback taking callable types into a continuable. This applies to calls which pass an error code as first parameter and the rest of the asynchronous result afterwards.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<h2>Function documentation</h2>
|
||||||
|
<section class="m-dox-details" id="a28834d45efa0e6d2e22771cdd38e33a4"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename... Result>
|
||||||
|
template<typename Callable, typename... Args>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">static auto cti::<wbr />promisify<Result>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a28834d45efa0e6d2e22771cdd38e33a4" class="m-dox-self">from</a>(</span><span class="m-dox-wrap">Callable&& callable,
|
||||||
|
Args&&... args)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Converts callback taking callable types into a continuable. This applies to calls which pass an error code as first parameter and the rest of the asynchronous result afterwards.</p>
|
||||||
|
<p>See an example of how to promisify boost asio's async_resolve below:</p><pre class="m-code"><span class="k">auto</span> <span class="nf">async_resolve</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">host</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">service</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">return</span> <span class="n">cti</span><span class="o">::</span><span class="n">promisify</span><span class="o"><</span><span class="n">asio</span><span class="o">::</span><span class="n">ip</span><span class="o">::</span><span class="n">udp</span><span class="o">::</span><span class="n">resolver</span><span class="o">::</span><span class="n">iterator</span><span class="o">>::</span><span class="n">from</span><span class="p">(</span>
|
||||||
|
<span class="p">[</span><span class="o">&</span><span class="p">](</span><span class="k">auto</span><span class="o">&&</span><span class="p">...</span> <span class="n">args</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="n">resolver_</span><span class="p">.</span><span class="n">async_resolve</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">forward</span><span class="o"><</span><span class="k">decltype</span><span class="p">(</span><span class="n">args</span><span class="p">)</span><span class="o">></span><span class="p">(</span><span class="n">args</span><span class="p">)...);</span>
|
||||||
|
<span class="p">},</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">host</span><span class="p">),</span> <span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">service</span><span class="p">));</span>
|
||||||
|
<span class="p">}</span></pre><p>A given error variable is converted to the used error type. If this isn't possible you need to create a custom resolver callable object</p><aside class="m-note m-default"><h4>See also</h4><p><a href="classcti_1_1promisify.html#a544cd0fd6e3466b9c3c45079803d6b84" class="m-dox">with</a> for details.</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="a544cd0fd6e3466b9c3c45079803d6b84"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename... Result>
|
||||||
|
template<typename Resolver, typename Callable, typename... Args>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">static auto cti::<wbr />promisify<Result>::<wbr /></span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#a544cd0fd6e3466b9c3c45079803d6b84" class="m-dox-self">with</a>(</span><span class="m-dox-wrap">Resolver&& resolver,
|
||||||
|
Callable&& callable,
|
||||||
|
Args&&... args)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Converts callback taking callable types into a continuable. This applies to calls which pass an error code as first parameter and the rest of the asynchronous result afterwards.</p>
|
||||||
|
<p>This modification of <a href="classcti_1_1promisify.html#a28834d45efa0e6d2e22771cdd38e33a4" class="m-dox">from</a> additionally takes a resolver callable object which is used to resolve the promise from the given result.</p><p>See an example of how to promisify boost asio's async_resolve below:</p><pre class="m-code"><span class="k">auto</span> <span class="nf">async_resolve</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">host</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">service</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">return</span> <span class="n">cti</span><span class="o">::</span><span class="n">promisify</span><span class="o"><</span><span class="n">asio</span><span class="o">::</span><span class="n">ip</span><span class="o">::</span><span class="n">udp</span><span class="o">::</span><span class="n">resolver</span><span class="o">::</span><span class="n">iterator</span><span class="o">>::</span><span class="n">with</span><span class="p">(</span>
|
||||||
|
<span class="p">[](</span><span class="k">auto</span><span class="o">&&</span> <span class="n">promise</span><span class="p">,</span> <span class="k">auto</span><span class="o">&&</span> <span class="n">e</span><span class="p">,</span> <span class="k">auto</span><span class="o">&&</span><span class="p">...</span> <span class="n">args</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">if</span> <span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="n">promise</span><span class="p">.</span><span class="n">set_exception</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">forward</span><span class="o"><</span><span class="k">decltype</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="o">></span><span class="p">(</span><span class="n">e</span><span class="p">));</span>
|
||||||
|
<span class="p">}</span> <span class="k">else</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">std</span><span class="o">::</span><span class="n">forward</span><span class="o"><</span><span class="k">decltype</span><span class="p">(</span><span class="n">args</span><span class="p">)</span><span class="o">></span><span class="p">(</span><span class="n">args</span><span class="p">)...);</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="p">},</span>
|
||||||
|
<span class="p">[</span><span class="o">&</span><span class="p">](</span><span class="k">auto</span><span class="o">&&</span><span class="p">...</span> <span class="n">args</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="n">resolver_</span><span class="p">.</span><span class="n">async_resolve</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">forward</span><span class="o"><</span><span class="k">decltype</span><span class="p">(</span><span class="n">args</span><span class="p">)</span><span class="o">></span><span class="p">(</span><span class="n">args</span><span class="p">)...);</span>
|
||||||
|
<span class="p">},</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">host</span><span class="p">),</span> <span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">service</span><span class="p">));</span>
|
||||||
|
<span class="p">}</span></pre><aside class="m-note m-default"><h4>Since</h4><p>3.1.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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
158
configuration.html
Normal file
158
configuration.html
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
<!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>Configuration | 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" id="m-navbar-current">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">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>
|
||||||
|
Configuration
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p>Covers optional preprocessor macros that change the libraries behaviour.</p>
|
||||||
|
<p>By default the library doesn't require any preprocessor definitions to be defined in order to work. However it is possible to define some in order to change the libraries behaviour:</p><table class="m-table"><thead><tr><th>Preprocessor definition</th><th>Consequence</th></tr></thead><tbody><tr><td><code>CONTINUABLE_WITH_NO_EXCEPTIONS</code></td><td>Exceptions are disabled and <code>std::error_condition</code> is used as <a href="group___base.html#ga7fcba5095c36f2577e1f4a2c5608dc6a" class="m-dox">error_<wbr />type</a> . See <a href="tutorial-chaining-continuables.html#tutorial-chaining-continuables-fail" class="m-dox">Using fail and exceptions</a> for details.</td></tr><tr><td><code>CONTINUABLE_WITH_CUSTOM_ERROR_TYPE</code></td><td>Exceptions are disabled and the type defined by <code>CONTINUABLE_WITH_CUSTOM_ERROR_TYPE</code> is used as <a href="group___base.html#ga7fcba5095c36f2577e1f4a2c5608dc6a" class="m-dox">error_<wbr />type</a> . See <a href="tutorial-chaining-continuables.html#tutorial-chaining-continuables-fail" class="m-dox">Using fail and exceptions</a> for details.</td></tr><tr><td><code>CONTINUABLE_WITH_UNHANDLED_EXCEPTIONS</code></td><td>Allows unhandled exceptions in asynchronous call hierarchies. See <a href="tutorial-chaining-continuables.html#tutorial-chaining-continuables-fail" class="m-dox">Using fail and exceptions</a> for details.</td></tr><tr><td><code>CONTINUABLE_WITH_EXPERIMENTAL_COROUTINE</code></td><td>Enables support for experimental coroutines and <code>co_await</code> expressions. See <a href="classcti_1_1continuable__base.html#ac79b103d5c000a3a3d1b98d8adcf58e8" class="m-dox">continuable_base::<wbr />operator co_await()</a> for details.</td></tr></tbody></table>
|
||||||
|
</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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
170
files.html
Normal file
170
files.html
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
<!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>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">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>Files</h2>
|
||||||
|
<ul class="m-dox">
|
||||||
|
</ul>
|
||||||
|
<script>
|
||||||
|
function toggle(e) {
|
||||||
|
e.parentElement.className = e.parentElement.className == 'm-dox-collapsible' ?
|
||||||
|
'm-dox-expansible' : 'm-dox-collapsible';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Collapse all nodes marked as such. Doing it via JS instead of directly in
|
||||||
|
markup so disabling it doesn't harm usability. The list is somehow
|
||||||
|
regenerated on every iteration and shrinks as I change the classes. It's not
|
||||||
|
documented anywhere and I'm not sure if this is the same across browsers, so
|
||||||
|
I am going backwards in that list to be sure. */
|
||||||
|
var collapsed = document.getElementsByClassName("collapsed");
|
||||||
|
for(var i = collapsed.length - 1; i >= 0; --i)
|
||||||
|
collapsed[i].className = 'm-dox-expansible';
|
||||||
|
</script>
|
||||||
|
</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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
405
group___base.html
Normal file
405
group___base.html
Normal file
@ -0,0 +1,405 @@
|
|||||||
|
<!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<typename Data, typename Annotation></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<typename Data, typename Hint></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'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<typename T></div>
|
||||||
|
using <a href="#gabe4e73c301a2697d9252c400194474e0" class="m-dox">is_continuable</a> = detail::base::is_continuable<T>
|
||||||
|
</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<typename... Args, typename Continuation></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#gaf47869ea139d88976af5b9654d6d61c0" class="m-dox">make_continuable</a>(</span><span class="m-dox-wrap">Continuation&& continuation) -> 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<typename... Args></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#gaa638513fe4c0a80b9ad445f8dff91250" class="m-dox">make_ready_continuable</a>(</span><span class="m-dox-wrap">) -> 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<typename Result></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&& result) -> 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<typename FirstResult, typename SecondResult, typename... Rest></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&& first_result,
|
||||||
|
SecondResult&& second_result,
|
||||||
|
Rest&&... rest) -> 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<typename... Signature, typename Exception></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&& exception) -> 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<typename T>
|
||||||
|
</div>
|
||||||
|
using <a href="#gabe4e73c301a2697d9252c400194474e0" class="m-dox-self">is_continuable</a> = detail::base::is_continuable<T>
|
||||||
|
</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<typename... Args, typename Continuation>
|
||||||
|
</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&& 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"><</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">></span><span class="p">([](</span><span class="k">auto</span><span class="o">&&</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">"<html>...</html>"</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"><</span><span class="kt">void</span><span class="o">></span><span class="p">([](</span><span class="k">auto</span><span class="o">&&</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'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'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">&&</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">'c'</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"><</span><span class="kt">float</span><span class="p">,</span> <span class="kt">char</span><span class="o">></span> <span class="n">ct</span> <span class="o">=</span> <span class="p">[](</span><span class="k">auto</span><span class="o">&&</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">'c'</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"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></span><span class="p">([](</span><span class="k">auto</span><span class="o">&&</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">"result"</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'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"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></span><span class="p">([](</span><span class="k">auto</span><span class="o">&&</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">"result"</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"><</span><span class="k">typename</span> <span class="n">T</span><span class="o">></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">&&</span> <span class="n">continuation</span><span class="p">)</span> <span class="o">&&</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"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></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"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></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"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></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">"result"</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'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<typename... Args>
|
||||||
|
</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'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<typename Result>
|
||||||
|
</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&& 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'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<typename FirstResult, typename SecondResult, typename... Rest>
|
||||||
|
</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&& first_result,
|
||||||
|
SecondResult&& second_result,
|
||||||
|
Rest&&... 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'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<typename... Signature, typename Exception>
|
||||||
|
</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&& 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">"Some issue!"</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"><</span><span class="kt">int</span><span class="o">></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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
443
group___connections.html
Normal file
443
group___connections.html
Normal file
@ -0,0 +1,443 @@
|
|||||||
|
<!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>Connections 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">Base</a></li>
|
||||||
|
<li><a href="group___connections.html" id="m-navbar-current">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>
|
||||||
|
Connections <span class="m-thin">module</span></h1>
|
||||||
|
<p>provides functions to connect <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />bases</a> through various strategies.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
Reference
|
||||||
|
<ul>
|
||||||
|
<li><a href="#func-members">Functions</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<section id="func-members">
|
||||||
|
<h2><a href="#func-members">Functions</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename... Args></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#gaef652b8561f76cad49e83cfa21a71734" class="m-dox">when_all</a>(</span><span class="m-dox-wrap">Args&&... args) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Connects the given arguments with an all logic. All continuables contained inside the given nested pack are invoked at once. On completion the final handler is called with the aggregated result of all continuables.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Iterator, std::enable_if_t<detail::range::is_iterator<Iterator>::value>* = nullptr></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#gaa39f871e8aa99953dc83fda92b449024" class="m-dox">when_all</a>(</span><span class="m-dox-wrap">Iterator begin,
|
||||||
|
Iterator end) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Connects the given arguments with an all logic. The content of the iterator is moved out and converted to a temporary <code>std::vector</code> which is then passed to when_all.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename... Args></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ga481c31024079b6074617c64b16e615dd" class="m-dox">when_seq</a>(</span><span class="m-dox-wrap">Args&&... args) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Connects the given arguments with a sequential logic. All continuables contained inside the given nested pack are invoked one after one. On completion the final handler is called with the aggregated result of all continuables.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Iterator, std::enable_if_t<detail::range::is_iterator<Iterator>::value>* = nullptr></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ga1d52caeca48122b5aebb276d0d47805a" class="m-dox">when_seq</a>(</span><span class="m-dox-wrap">Iterator begin,
|
||||||
|
Iterator end) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Connects the given arguments with a sequential logic. The content of the iterator is moved out and converted to a temporary <code>std::vector</code> which is then passed to when_seq.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename... Args></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ga313760e876d0cbc766b41f6b192544bb" class="m-dox">when_any</a>(</span><span class="m-dox-wrap">Args&&... args) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Connects the given arguments with an any logic. All continuables contained inside the given nested pack are invoked at once. On completion of one continuable the final handler is called with the result of the resolved continuable.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Iterator, std::enable_if_t<detail::range::is_iterator<Iterator>::value>* = nullptr></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ga580b6b0d4fd31371b2f37e0dc5bf039b" class="m-dox">when_any</a>(</span><span class="m-dox-wrap">Iterator begin,
|
||||||
|
Iterator end) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Connects the given arguments with an any logic. The content of the iterator is moved out and converted to a temporary <code>std::vector</code> which is then passed to when_all.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<template<typename, typename> class C = std::vector, typename First, typename... Args></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ga4f6ecedf4b4ccd5e1c28d937ad717b32" class="m-dox">populate</a>(</span><span class="m-dox-wrap">First&& first,
|
||||||
|
Args&&... args) -> C<std::decay_t<First>, std::allocator<std::decay_t<First>>></span>
|
||||||
|
</dt>
|
||||||
|
<dd>Populates a homogeneous container from the given arguments. All arguments need to be convertible to the first one, by default <code>std::vector</code> is used as container type.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<h2>Function documentation</h2>
|
||||||
|
<section class="m-dox-details" id="gaef652b8561f76cad49e83cfa21a71734"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename... Args>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#gaef652b8561f76cad49e83cfa21a71734" class="m-dox-self">when_all</a>(</span><span class="m-dox-wrap">Args&&... args)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Connects the given arguments with an all logic. All continuables contained inside the given nested pack are invoked at once. On completion the final handler is called with the aggregated result of all continuables.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">args</td>
|
||||||
|
<td><p>Arbitrary arguments which are connected. Every type is allowed as arguments, continuables may be contained inside tuple like types (<code>std::tuple</code>) or in homogeneous containers such as <code>std::vector</code>. Non continuable arguments are preserved and passed to the final result as shown below:</p><pre class="m-code"><span class="n">cti</span><span class="o">::</span><span class="n">when_all</span><span class="p">(</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
|
||||||
|
<span class="mi">2</span><span class="p">,</span> <span class="c1">//< See this plain value</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">populate</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">3</span><span class="p">),</span> <span class="c1">// Creates a runtime</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">4</span><span class="p">)),</span> <span class="c1">// sized container.</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">5</span><span class="p">))))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="kt">int</span> <span class="n">r0</span><span class="p">,</span> <span class="kt">int</span> <span class="n">r1</span><span class="p">,</span> <span class="kt">int</span> <span class="n">r2</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o"><</span><span class="kt">int</span><span class="o">></span> <span class="n">r34</span><span class="p">,</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o"><</span><span class="kt">int</span><span class="o">>></span> <span class="n">r5</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-default"><h4>See also</h4><p>continuable_base::operator&& for details.</p></aside><aside class="m-note m-default"><h4>Since</h4><p>1.1.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="gaa39f871e8aa99953dc83fda92b449024"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Iterator, std::enable_if_t<detail::range::is_iterator<Iterator>::value>* = nullptr>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#gaa39f871e8aa99953dc83fda92b449024" class="m-dox-self">when_all</a>(</span><span class="m-dox-wrap">Iterator begin,
|
||||||
|
Iterator end)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Connects the given arguments with an all logic. The content of the iterator is moved out and converted to a temporary <code>std::vector</code> which is then passed to when_all.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">begin</td>
|
||||||
|
<td>The begin iterator to the range which will be moved out and used as the arguments to the all connection</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>end</td>
|
||||||
|
<td>The end iterator to the range which will be moved out and used as the arguments to the all connection</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<pre class="m-code"><span class="c1">// cti::populate just creates a std::vector from the two continuables.</span>
|
||||||
|
<span class="k">auto</span> <span class="n">v</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">populate</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">1</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">when_all</span><span class="p">(</span><span class="n">v</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">v</span><span class="p">.</span><span class="n">end</span><span class="p">())</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o"><</span><span class="kt">int</span><span class="o">></span> <span class="n">r01</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre><aside class="m-note m-default"><h4>See also</h4><p><a href="group___connections.html#gaef652b8561f76cad49e83cfa21a71734" class="m-dox">when_<wbr />all</a> for details.</p></aside><aside class="m-note m-warning"><h4>Attention</h4><p>Prefer to invoke when_all with the whole container the iterators were taken from, since this saves us the creation of a temporary storage.</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="ga481c31024079b6074617c64b16e615dd"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename... Args>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ga481c31024079b6074617c64b16e615dd" class="m-dox-self">when_seq</a>(</span><span class="m-dox-wrap">Args&&... args)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Connects the given arguments with a sequential logic. All continuables contained inside the given nested pack are invoked one after one. On completion the final handler is called with the aggregated result of all continuables.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">args</td>
|
||||||
|
<td><p>Arbitrary arguments which are connected. Every type is allowed as arguments, continuables may be contained inside tuple like types (<code>std::tuple</code>) or in homogeneous containers such as <code>std::vector</code>. Non continuable arguments are preserved and passed to the final result as shown below:</p><pre class="m-code"><span class="n">cti</span><span class="o">::</span><span class="n">when_seq</span><span class="p">(</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
|
||||||
|
<span class="mi">2</span><span class="p">,</span> <span class="c1">//< See this plain value</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">populate</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">3</span><span class="p">),</span> <span class="c1">// Creates a runtime</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">4</span><span class="p">)),</span> <span class="c1">// sized container.</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">5</span><span class="p">))))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="kt">int</span> <span class="n">r0</span><span class="p">,</span> <span class="kt">int</span> <span class="n">r1</span><span class="p">,</span> <span class="kt">int</span> <span class="n">r2</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o"><</span><span class="kt">int</span><span class="o">></span> <span class="n">r34</span><span class="p">,</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o"><</span><span class="kt">int</span><span class="o">>></span> <span class="n">r5</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-default"><h4>See also</h4><p><a href="classcti_1_1continuable__base.html#abaaaf8a35827456fead299851268760e" class="m-dox">continuable_base::<wbr />operator>></a> for details.</p></aside><aside class="m-note m-default"><h4>Since</h4><p>1.1.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="ga1d52caeca48122b5aebb276d0d47805a"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Iterator, std::enable_if_t<detail::range::is_iterator<Iterator>::value>* = nullptr>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ga1d52caeca48122b5aebb276d0d47805a" class="m-dox-self">when_seq</a>(</span><span class="m-dox-wrap">Iterator begin,
|
||||||
|
Iterator end)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Connects the given arguments with a sequential logic. The content of the iterator is moved out and converted to a temporary <code>std::vector</code> which is then passed to when_seq.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">begin</td>
|
||||||
|
<td>The begin iterator to the range which will be moved out and used as the arguments to the sequential connection</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>end</td>
|
||||||
|
<td>The end iterator to the range which will be moved out and used as the arguments to the sequential connection</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<pre class="m-code"><span class="c1">// cti::populate just creates a std::vector from the two continuables.</span>
|
||||||
|
<span class="k">auto</span> <span class="n">v</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">populate</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">1</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">when_seq</span><span class="p">(</span><span class="n">v</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">v</span><span class="p">.</span><span class="n">end</span><span class="p">())</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o"><</span><span class="kt">int</span><span class="o">></span> <span class="n">r01</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre><aside class="m-note m-default"><h4>See also</h4><p><a href="group___connections.html#ga481c31024079b6074617c64b16e615dd" class="m-dox">when_<wbr />seq</a> for details.</p></aside><aside class="m-note m-warning"><h4>Attention</h4><p>Prefer to invoke when_seq with the whole container the iterators were taken from, since this saves us the creation of a temporary storage.</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="ga313760e876d0cbc766b41f6b192544bb"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename... Args>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ga313760e876d0cbc766b41f6b192544bb" class="m-dox-self">when_any</a>(</span><span class="m-dox-wrap">Args&&... args)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Connects the given arguments with an any logic. All continuables contained inside the given nested pack are invoked at once. On completion of one continuable the final handler is called with the result of the resolved continuable.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">args</td>
|
||||||
|
<td><p>Arbitrary arguments which are connected. Every type is allowed as arguments, continuables may be contained inside tuple like types (<code>std::tuple</code>) or in homogeneous containers such as <code>std::vector</code>. Non continuable arguments are preserved and passed to the final result as shown below:</p><pre class="m-code"><span class="n">cti</span><span class="o">::</span><span class="n">when_any</span><span class="p">(</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
|
||||||
|
<span class="mi">2</span><span class="p">,</span> <span class="c1">//< See this plain value</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">populate</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">3</span><span class="p">),</span> <span class="c1">// Creates a runtime</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">4</span><span class="p">)),</span> <span class="c1">// sized container.</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">5</span><span class="p">))))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="kt">int</span> <span class="n">r0</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-default"><h4>See also</h4><p><a href="classcti_1_1continuable__base.html#ada74584fb95bf00a50d05072e933c144" class="m-dox">continuable_base::<wbr />operator||</a> for details.</p></aside><aside class="m-note m-default"><h4>Since</h4><p>1.1.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="ga580b6b0d4fd31371b2f37e0dc5bf039b"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Iterator, std::enable_if_t<detail::range::is_iterator<Iterator>::value>* = nullptr>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ga580b6b0d4fd31371b2f37e0dc5bf039b" class="m-dox-self">when_any</a>(</span><span class="m-dox-wrap">Iterator begin,
|
||||||
|
Iterator end)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Connects the given arguments with an any logic. The content of the iterator is moved out and converted to a temporary <code>std::vector</code> which is then passed to when_all.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">begin</td>
|
||||||
|
<td>The begin iterator to the range which will be moved out and used as the arguments to the all connection</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>end</td>
|
||||||
|
<td>The end iterator to the range which will be moved out and used as the arguments to the all connection</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<pre class="m-code"><span class="c1">// cti::populate just creates a std::vector from the two continuables.</span>
|
||||||
|
<span class="k">auto</span> <span class="n">v</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">populate</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">1</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">when_any</span><span class="p">(</span><span class="n">v</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">v</span><span class="p">.</span><span class="n">end</span><span class="p">())</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="kt">int</span> <span class="n">r01</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre><aside class="m-note m-default"><h4>See also</h4><p><a href="group___connections.html#ga313760e876d0cbc766b41f6b192544bb" class="m-dox">when_<wbr />any</a> for details.</p></aside><aside class="m-note m-warning"><h4>Attention</h4><p>Prefer to invoke when_any with the whole container the iterators were taken from, since this saves us the creation of a temporary storage.</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="ga4f6ecedf4b4ccd5e1c28d937ad717b32"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<template<typename, typename> class C = std::vector, typename First, typename... Args>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">C<std::decay_t<First>, std::allocator<std::decay_t<First>>> </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ga4f6ecedf4b4ccd5e1c28d937ad717b32" class="m-dox-self">populate</a>(</span><span class="m-dox-wrap">First&& first,
|
||||||
|
Args&&... args)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Populates a homogeneous container from the given arguments. All arguments need to be convertible to the first one, by default <code>std::vector</code> is used as container 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%">C</td>
|
||||||
|
<td>The container type which is used to store the arguments into.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>First</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Args</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>This method mainly helps to create a homogeneous container from a runtime known count of continuables which type isn't exactly known. All continuables which are passed to this function should be originating from the same source or a method called with the same types of arguments:</p><pre class="m-code"><span class="k">auto</span> <span class="n">container</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">populate</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">1</span><span class="p">)),</span>
|
||||||
|
|
||||||
|
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">2</span><span class="p">;</span> <span class="n">i</span> <span class="o"><</span> <span class="mi">5</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// You may add more continuables to the container afterwards</span>
|
||||||
|
<span class="n">container</span><span class="p">.</span><span class="n">emplace_back</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="n">i</span><span class="p">));</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">when_any</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">container</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="kt">int</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre><p>Additionally it is possible to change the targeted container as below:</p><pre class="m-code"><span class="k">auto</span> <span class="n">container</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">populate</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">list</span><span class="o">></span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">1</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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
176
group___promisify.html
Normal file
176
group___promisify.html
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
<!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>Promisify 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">Base</a></li>
|
||||||
|
<li><a href="group___connections.html">Connections</a></li>
|
||||||
|
<li><a href="group___promisify.html" id="m-navbar-current">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>
|
||||||
|
Promisify <span class="m-thin">module</span></h1>
|
||||||
|
<p>provides helper methods to convert various callback styles to <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />bases</a>.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
Reference
|
||||||
|
<ul>
|
||||||
|
<li><a href="#nested-classes">Classes</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<typename... Result></div>
|
||||||
|
class <a href="classcti_1_1promisify.html" class="m-dox">cti::promisify</a>
|
||||||
|
</dt>
|
||||||
|
<dd>Helper class for converting callback taking callable types into a a continuable. Various styles are supported.</dd>
|
||||||
|
</dl>
|
||||||
|
</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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
312
group___testing.html
Normal file
312
group___testing.html
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
<!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>Testing 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">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" id="m-navbar-current">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>
|
||||||
|
Testing <span class="m-thin">module</span></h1>
|
||||||
|
<p>provides macro shortcuts for testing asynchronous continuations through GTest.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
Reference
|
||||||
|
<ul>
|
||||||
|
<li><a href="#defines">Defines</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<section id="define-members">
|
||||||
|
<h2><a href="#define-members">Defines</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#ga19705a633c93b9df4df17aa612138475" class="m-dox">ASSERT_ASYNC_COMPLETION</a>(</span><span class="m-dox-wrap">CONTINUABLE)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Asserts that the final callback of the given continuable was called with any result.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#ga83a8a6551404b672fed165166b0528c4" class="m-dox">ASSERT_ASYNC_EXCEPTION_COMPLETION</a>(</span><span class="m-dox-wrap">CONTINUABLE)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Asserts that the final callback of the given continuable was called with any exceptional result.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#gaa89eda3eb76b7604d75d1928e51e00b4" class="m-dox">ASSERT_ASYNC_INCOMPLETION</a>(</span><span class="m-dox-wrap">CONTINUABLE)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Asserts that the final callback of the given continuable is never called with any result.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#gadc19a4b21ca4f61f61c6c031dd57d822" class="m-dox-self" name="gadc19a4b21ca4f61f61c6c031dd57d822">ASSERT_ASYNC_VALIDATION</a>(</span><span class="m-dox-wrap">CONTINUABLE,
|
||||||
|
VALIDATOR)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Expects the continuation to be called and forwards it's arguments to the given validator which can then do assertions on the result.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#gaf8390b0c3997a58f77ec852c1121341e" class="m-dox">ASSERT_ASYNC_BINARY_VALIDATION</a>(</span><span class="m-dox-wrap">VALIDATOR,
|
||||||
|
...)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Asserts that the continuation was called and forwards it's arguments to the given validator which can then do assertions on the result.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#gaea321a35e497cff7f897482cb95f0d47" class="m-dox">ASSERT_ASYNC_BINARY_EXCEPTION_VALIDATION</a>(</span><span class="m-dox-wrap">VALIDATOR,
|
||||||
|
...)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Asserts that the continuation was resolved through an error and forwards it's error result to the given validator which can then do assertions on the error result.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#ga1c28bfaf6b8246a96ebe44020771c059" class="m-dox">EXPECT_ASYNC_RESULT</a>(</span><span class="m-dox-wrap">...)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Expects that the continuable is finished with the given result.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#ga98e249af2f132d3f30c63ed4ca8d0452" class="m-dox">EXPECT_ASYNC_EXCEPTION_RESULT</a>(</span><span class="m-dox-wrap">...)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Asserts that the continuable is finished with the given exception.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#ga0e66f753c9c0a3ef7c4b2313d5feef90" class="m-dox">ASSERT_ASYNC_RESULT</a>(</span><span class="m-dox-wrap">...)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Asserts that the continuable is finished with the given result.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#gafb7fdd53d1d70f518386fdda37dce87b" class="m-dox">ASSERT_ASYNC_TYPES</a>(</span><span class="m-dox-wrap">CONTINUABLE,
|
||||||
|
...)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Asserts that the continuable is finished with the given type of arguments without validating it against equality.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#ga913e34a5390c17cf27eb34674e5c6417" class="m-dox">ASSERT_ASYNC_EXCEPTION_RESULT</a>(</span><span class="m-dox-wrap">...)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Asserts that the continuable is finished with the given exception.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<h2>Define documentation</h2>
|
||||||
|
<section class="m-dox-details" id="ga19705a633c93b9df4df17aa612138475"><div>
|
||||||
|
<h3>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#ga19705a633c93b9df4df17aa612138475" class="m-dox-self">ASSERT_ASYNC_COMPLETION</a>(</span><span class="m-dox-wrap">CONTINUABLE)</span>
|
||||||
|
</h3>
|
||||||
|
<p>Asserts that the final callback of the given continuable was called with any result.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>1.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="ga83a8a6551404b672fed165166b0528c4"><div>
|
||||||
|
<h3>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#ga83a8a6551404b672fed165166b0528c4" class="m-dox-self">ASSERT_ASYNC_EXCEPTION_COMPLETION</a>(</span><span class="m-dox-wrap">CONTINUABLE)</span>
|
||||||
|
</h3>
|
||||||
|
<p>Asserts that the final callback of the given continuable was called with any exceptional result.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>2.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="gaa89eda3eb76b7604d75d1928e51e00b4"><div>
|
||||||
|
<h3>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#gaa89eda3eb76b7604d75d1928e51e00b4" class="m-dox-self">ASSERT_ASYNC_INCOMPLETION</a>(</span><span class="m-dox-wrap">CONTINUABLE)</span>
|
||||||
|
</h3>
|
||||||
|
<p>Asserts that the final callback of the given continuable is never called with any result.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>1.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="gaf8390b0c3997a58f77ec852c1121341e"><div>
|
||||||
|
<h3>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#gaf8390b0c3997a58f77ec852c1121341e" class="m-dox-self">ASSERT_ASYNC_BINARY_VALIDATION</a>(</span><span class="m-dox-wrap">VALIDATOR,
|
||||||
|
...)</span>
|
||||||
|
</h3>
|
||||||
|
<p>Asserts that the continuation was called and forwards it's arguments to the given validator which can then do assertions on the result.</p>
|
||||||
|
<p>A validator consists of a binary consumer with a signature as in in the example shown below:</p><pre class="m-code"><span class="k">auto</span> <span class="n">validator</span> <span class="o">=</span> <span class="p">[](</span><span class="k">auto</span> <span class="n">expected</span><span class="p">,</span> <span class="k">auto</span> <span class="n">actual</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="n">EXPECT_EQ</span><span class="p">(</span><span class="n">expected</span><span class="p">,</span> <span class="n">actual</span><span class="p">);</span>
|
||||||
|
<span class="p">};</span></pre><p>The macro is usable as shown in the following example:</p><pre class="m-code"><span class="n">continuable</span><span class="o"><</span><span class="n">string</span><span class="o">></span> <span class="n">async_get</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">);</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="k">auto</span> <span class="n">validator</span> <span class="o">=</span> <span class="p">[](</span><span class="k">auto</span> <span class="n">expected</span><span class="p">,</span> <span class="k">auto</span> <span class="n">actual</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="n">EXPECT_EQ</span><span class="p">(</span><span class="n">expected</span><span class="p">,</span> <span class="n">actual</span><span class="p">);</span>
|
||||||
|
<span class="p">};</span>
|
||||||
|
|
||||||
|
<span class="n">ASSERT_ASYNC_BINARY_VALIDATION</span><span class="p">(</span><span class="n">validator</span><span class="p">,</span> <span class="n">async_get</span><span class="p">(</span><span class="s">"hello"</span><span class="p">),</span> <span class="s">"hello"</span><span class="p">)</span></pre><p>The validator is called for every expecting and actual result.</p><aside class="m-note m-info"><h4>Note</h4><p>This macro is mainly present for building other assertions relying on custom validation logic.</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="gaea321a35e497cff7f897482cb95f0d47"><div>
|
||||||
|
<h3>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#gaea321a35e497cff7f897482cb95f0d47" class="m-dox-self">ASSERT_ASYNC_BINARY_EXCEPTION_VALIDATION</a>(</span><span class="m-dox-wrap">VALIDATOR,
|
||||||
|
...)</span>
|
||||||
|
</h3>
|
||||||
|
<p>Asserts that the continuation was resolved through an error and forwards it's error result to the given validator which can then do assertions on the error result.</p>
|
||||||
|
<aside class="m-note m-info"><h4>Note</h4><p>This macro is mainly present for building other assertions relying on custom validation logic.</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="ga1c28bfaf6b8246a96ebe44020771c059"><div>
|
||||||
|
<h3>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#ga1c28bfaf6b8246a96ebe44020771c059" class="m-dox-self">EXPECT_ASYNC_RESULT</a>(</span><span class="m-dox-wrap">...)</span>
|
||||||
|
</h3>
|
||||||
|
<p>Expects that the continuable is finished with the given result.</p>
|
||||||
|
<pre class="m-code"><span class="n">continuable</span><span class="o"><</span><span class="n">string</span><span class="o">></span> <span class="n">async_get</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">);</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
|
||||||
|
<span class="n">EXPECT_ASYNC_RESULT</span><span class="p">(</span><span class="n">async_get</span><span class="p">(</span><span class="s">"hello"</span><span class="p">),</span> <span class="s">"hello"</span><span class="p">);</span></pre><aside class="m-note m-default"><h4>Since</h4><p>1.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="ga98e249af2f132d3f30c63ed4ca8d0452"><div>
|
||||||
|
<h3>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#ga98e249af2f132d3f30c63ed4ca8d0452" class="m-dox-self">EXPECT_ASYNC_EXCEPTION_RESULT</a>(</span><span class="m-dox-wrap">...)</span>
|
||||||
|
</h3>
|
||||||
|
<p>Asserts that the continuable is finished with the given exception.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>2.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="ga0e66f753c9c0a3ef7c4b2313d5feef90"><div>
|
||||||
|
<h3>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#ga0e66f753c9c0a3ef7c4b2313d5feef90" class="m-dox-self">ASSERT_ASYNC_RESULT</a>(</span><span class="m-dox-wrap">...)</span>
|
||||||
|
</h3>
|
||||||
|
<p>Asserts that the continuable is finished with the given result.</p>
|
||||||
|
<pre class="m-code"><span class="n">continuable</span><span class="o"><</span><span class="n">string</span><span class="o">></span> <span class="n">async_get</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">);</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
|
||||||
|
<span class="n">ASSERT_ASYNC_RESULT</span><span class="p">(</span><span class="n">async_get</span><span class="p">(</span><span class="s">"hello"</span><span class="p">),</span> <span class="s">"hello"</span><span class="p">);</span></pre><aside class="m-note m-default"><h4>Since</h4><p>1.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="gafb7fdd53d1d70f518386fdda37dce87b"><div>
|
||||||
|
<h3>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#gafb7fdd53d1d70f518386fdda37dce87b" class="m-dox-self">ASSERT_ASYNC_TYPES</a>(</span><span class="m-dox-wrap">CONTINUABLE,
|
||||||
|
...)</span>
|
||||||
|
</h3>
|
||||||
|
<p>Asserts that the continuable is finished with the given type of arguments without validating it against equality.</p>
|
||||||
|
<pre class="m-code"><span class="n">continuable</span><span class="o"><</span><span class="n">string</span><span class="o">></span> <span class="n">async_get</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">);</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
|
||||||
|
<span class="n">ASSERT_ASYNC_TYPES</span><span class="p">(</span><span class="n">async_get</span><span class="p">(</span><span class="s">"hello"</span><span class="p">),</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">);</span></pre><aside class="m-note m-info"><h4>Note</h4><p>This is a compile-time assertion.</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="ga913e34a5390c17cf27eb34674e5c6417"><div>
|
||||||
|
<h3>
|
||||||
|
<span class="m-dox-wrap-bumper">#define <a href="#ga913e34a5390c17cf27eb34674e5c6417" class="m-dox-self">ASSERT_ASYNC_EXCEPTION_RESULT</a>(</span><span class="m-dox-wrap">...)</span>
|
||||||
|
</h3>
|
||||||
|
<p>Asserts that the continuable is finished with the given exception.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>2.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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
259
group___transforms.html
Normal file
259
group___transforms.html
Normal file
@ -0,0 +1,259 @@
|
|||||||
|
<!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>Transforms 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">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" id="m-navbar-current">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>
|
||||||
|
Transforms <span class="m-thin">module</span></h1>
|
||||||
|
<p>provides utilities to convert <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />bases</a> to other types such as (<code>std::future</code>).</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
Reference
|
||||||
|
<ul>
|
||||||
|
<li><a href="#namespaces">Namespaces</a></li>
|
||||||
|
<li><a href="#typedef-members">Typedefs</a></li>
|
||||||
|
<li><a href="#func-members">Functions</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<section id="namespaces">
|
||||||
|
<h2><a href="#namespaces">Namespaces</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>namespace <a href="namespacecti_1_1transforms.html" class="m-dox">cti::transforms</a></dt>
|
||||||
|
<dd>The namespace transforms declares callable objects that transform any <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> to an object or to a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> itself.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section id="typedef-members">
|
||||||
|
<h2><a href="#typedef-members">Typedefs</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename T></div>
|
||||||
|
using <a href="#gad64ab92505da9dbc999ecc6f964d47c2" class="m-dox">transform</a> = detail::types::transform<T>
|
||||||
|
</dt>
|
||||||
|
<dd>A callable tag object which marks a wrapped callable object as continuable transformation which enables some useful overloads.</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<typename T></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ga2383cf2e4cf7d8d43efeb25f790be006" class="m-dox">make_transform</a>(</span><span class="m-dox-wrap">T&& callable) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Wraps the given callable object into a transform class.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#gac698fd2486d980302cbd956fdeafdfde" class="m-dox">futurize</a>(</span><span class="m-dox-wrap">) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Returns a transform that if applied to a continuable, it will start the continuation chain and returns the asynchronous result as <code>std::future<...></code>.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ga9b0b1ba047ea018c7f211ea14c6d2a64" class="m-dox">flatten</a>(</span><span class="m-dox-wrap">) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Returns a transform that if applied to a continuable, it will ignores all error which ocured until the point the transform was applied.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<h2>Typedef documentation</h2>
|
||||||
|
<section class="m-dox-details" id="gad64ab92505da9dbc999ecc6f964d47c2"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename T>
|
||||||
|
</div>
|
||||||
|
using <a href="#gad64ab92505da9dbc999ecc6f964d47c2" class="m-dox-self">transform</a> = detail::types::transform<T>
|
||||||
|
</h3>
|
||||||
|
<p>A callable tag object which marks a wrapped callable object as continuable transformation which enables some useful overloads.</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="ga2383cf2e4cf7d8d43efeb25f790be006"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename T>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ga2383cf2e4cf7d8d43efeb25f790be006" class="m-dox-self">make_transform</a>(</span><span class="m-dox-wrap">T&& callable)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Wraps the given callable object into a transform class.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>3.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="gac698fd2486d980302cbd956fdeafdfde"><div>
|
||||||
|
<h3>
|
||||||
|
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#gac698fd2486d980302cbd956fdeafdfde" class="m-dox-self">futurize</a>(</span><span class="m-dox-wrap">)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Returns a transform that if applied to a continuable, it will start the continuation chain and returns the asynchronous result as <code>std::future<...></code>.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 1%">Returns</th>
|
||||||
|
<td><p>Returns a <code>std::future<...></code> which becomes ready as soon as the the continuation chain has finished. The signature of the future depends on the result type:</p><table class="m-table"><thead><tr><th>Continuation type</th><th>Return type</th></tr></thead><tbody><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <></code></td><td><code>std::future<void></code></td></tr><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <Arg></code></td><td><code>std::future<Arg></code></td></tr><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <Args...></code></td><td><code>std::future<std::tuple<Args...>></code></td></tr></tbody></table></td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-warning"><h4>Attention</h4><p>If exceptions are used, exceptions that are thrown, are forwarded to the returned future. If there are no exceptions supported, you shall not pass any errors to the end of the asynchronous call chain! Otherwise this will yield a trap that causes application exit.</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="ga9b0b1ba047ea018c7f211ea14c6d2a64"><div>
|
||||||
|
<h3>
|
||||||
|
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ga9b0b1ba047ea018c7f211ea14c6d2a64" class="m-dox-self">flatten</a>(</span><span class="m-dox-wrap">)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Returns a transform that if applied to a continuable, it will ignores all error which ocured until the point the transform was applied.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 1%">Returns</th>
|
||||||
|
<td>Returns a continuable with the same signature as applied to.</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<aside class="m-note m-warning"><h4>Attention</h4><p>This can be used to create a continuable which doesn't resolve the continuation on errors.</p></aside><aside class="m-note m-default"><h4>Since</h4><p>2.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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
356
group___traversal.html
Normal file
356
group___traversal.html
Normal file
@ -0,0 +1,356 @@
|
|||||||
|
<!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>Traversal 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">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" id="m-navbar-current">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>
|
||||||
|
Traversal <span class="m-thin">module</span></h1>
|
||||||
|
<p>provides functions to traverse and remap nested packs.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
Reference
|
||||||
|
<ul>
|
||||||
|
<li><a href="#typedef-members">Typedefs</a></li>
|
||||||
|
<li><a href="#func-members">Functions</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<section id="typedef-members">
|
||||||
|
<h2><a href="#typedef-members">Typedefs</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
using <a href="#ga170b41a7aacd94036f9da0af42c6558d" class="m-dox">async_traverse_visit_tag</a> = detail::traversal::async_traverse_visit_tag
|
||||||
|
</dt>
|
||||||
|
<dd>A tag which is passed to the <code>operator()</code> of the visitor if an element is visited synchronously through <a href="group___traversal.html#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_<wbr />pack_<wbr />async</a>.</dd>
|
||||||
|
<dt>
|
||||||
|
using <a href="#gacc6d0dce8126550436303d433c96b1d7" class="m-dox">async_traverse_detach_tag</a> = detail::traversal::async_traverse_detach_tag
|
||||||
|
</dt>
|
||||||
|
<dd>A tag which is passed to the <code>operator()</code> of the visitor if an element is visited after the traversal was detached through <a href="group___traversal.html#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_<wbr />pack_<wbr />async</a>.</dd>
|
||||||
|
<dt>
|
||||||
|
using <a href="#ga1c9f6c5ba9ffb68ff36a1f95b78e7d3a" class="m-dox">async_traverse_complete_tag</a> = detail::traversal::async_traverse_complete_tag
|
||||||
|
</dt>
|
||||||
|
<dd>A tag which is passed to the <code>operator()</code> of the visitor if the asynchronous pack traversal was finished through <a href="group___traversal.html#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_<wbr />pack_<wbr />async</a>.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename T></div>
|
||||||
|
using <a href="#gaf67b511265fa74dc4b117cdb1ce9d1e3" class="m-dox">async_traverse_in_place_tag</a> = detail::traversal::async_traverse_in_place_tag<T>
|
||||||
|
</dt>
|
||||||
|
<dd>A tag to identify that a mapper shall be constructed in-place from the first argument passed to <a href="group___traversal.html#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_<wbr />pack_<wbr />async</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<typename Visitor, typename... T></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_pack_async</a>(</span><span class="m-dox-wrap">Visitor&& visitor,
|
||||||
|
T&&... pack) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Traverses the pack with the given visitor in an asynchronous way.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Mapper, typename... T></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#gace27f8127eb5eba0f4ab753daacf6a57" class="m-dox">map_pack</a>(</span><span class="m-dox-wrap">Mapper&& mapper,
|
||||||
|
T&&... pack) -> decltype(auto)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Maps the pack with the given mapper.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename... T></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="#ga7c14358f4d11803b50ab9687dfcb11c5" class="m-dox">spread_this</a>(</span><span class="m-dox-wrap">T&&... args) -> detail::traversal::spreading::spread_box<std::decay_t<T>...> <span class="m-label m-flat m-primary">constexpr</span></span>
|
||||||
|
</dt>
|
||||||
|
<dd>Indicate that the result shall be spread across the parent container if possible. This can be used to create a mapper function used in map_pack that maps one element to an arbitrary count (1:n).</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Mapper, typename... T></div>
|
||||||
|
<span class="m-dox-wrap-bumper">void <a href="#gab497ec8ef4cf8532703fcb9852846a2e" class="m-dox">traverse_pack</a>(</span><span class="m-dox-wrap">Mapper&& mapper,
|
||||||
|
T&&... pack)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Traverses the pack with the given visitor.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<h2>Typedef documentation</h2>
|
||||||
|
<section class="m-dox-details" id="ga170b41a7aacd94036f9da0af42c6558d"><div>
|
||||||
|
<h3>
|
||||||
|
using <a href="#ga170b41a7aacd94036f9da0af42c6558d" class="m-dox-self">async_traverse_visit_tag</a> = detail::traversal::async_traverse_visit_tag
|
||||||
|
</h3>
|
||||||
|
<p>A tag which is passed to the <code>operator()</code> of the visitor if an element is visited synchronously through <a href="group___traversal.html#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_<wbr />pack_<wbr />async</a>.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>3.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="gacc6d0dce8126550436303d433c96b1d7"><div>
|
||||||
|
<h3>
|
||||||
|
using <a href="#gacc6d0dce8126550436303d433c96b1d7" class="m-dox-self">async_traverse_detach_tag</a> = detail::traversal::async_traverse_detach_tag
|
||||||
|
</h3>
|
||||||
|
<p>A tag which is passed to the <code>operator()</code> of the visitor if an element is visited after the traversal was detached through <a href="group___traversal.html#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_<wbr />pack_<wbr />async</a>.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>3.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="ga1c9f6c5ba9ffb68ff36a1f95b78e7d3a"><div>
|
||||||
|
<h3>
|
||||||
|
using <a href="#ga1c9f6c5ba9ffb68ff36a1f95b78e7d3a" class="m-dox-self">async_traverse_complete_tag</a> = detail::traversal::async_traverse_complete_tag
|
||||||
|
</h3>
|
||||||
|
<p>A tag which is passed to the <code>operator()</code> of the visitor if the asynchronous pack traversal was finished through <a href="group___traversal.html#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_<wbr />pack_<wbr />async</a>.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>3.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="gaf67b511265fa74dc4b117cdb1ce9d1e3"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename T>
|
||||||
|
</div>
|
||||||
|
using <a href="#gaf67b511265fa74dc4b117cdb1ce9d1e3" class="m-dox-self">async_traverse_in_place_tag</a> = detail::traversal::async_traverse_in_place_tag<T>
|
||||||
|
</h3>
|
||||||
|
<p>A tag to identify that a mapper shall be constructed in-place from the first argument passed to <a href="group___traversal.html#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_<wbr />pack_<wbr />async</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="ga02922d0c5bf7a18340069b3500a0cf90"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Visitor, typename... T>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox-self">traverse_pack_async</a>(</span><span class="m-dox-wrap">Visitor&& visitor,
|
||||||
|
T&&... pack)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Traverses the pack with the given visitor in an asynchronous way.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">visitor</td>
|
||||||
|
<td>A visitor object which provides the three <code>operator()</code> overloads that were described above. Additionally the visitor must be compatible for referencing it from a <code>boost::intrusive_ptr</code>. The visitor should must have a virtual destructor!</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>pack</td>
|
||||||
|
<td>The arbitrary parameter pack which is traversed asynchronously. Nested objects inside containers and tuple like types are traversed recursively.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Returns</th>
|
||||||
|
<td>A std::shared_ptr that references an instance of the given visitor object.</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<p>This function works in the same way as <code>traverse_pack</code>, however, we are able to suspend and continue the traversal at later time. Thus we require a visitor callable object which provides three <code>operator()</code> overloads as depicted by the code sample below:</p><pre class="m-code"><span class="k">struct</span> <span class="n">my_async_visitor</span> <span class="p">{</span>
|
||||||
|
<span class="k">template</span> <span class="o"><</span><span class="k">typename</span> <span class="n">T</span><span class="o">></span>
|
||||||
|
<span class="kt">bool</span> <span class="k">operator</span><span class="p">()(</span><span class="n">async_traverse_visit_tag</span><span class="p">,</span> <span class="n">T</span><span class="o">&&</span> <span class="n">element</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">return</span> <span class="nb">true</span><span class="p">;</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="k">template</span> <span class="o"><</span><span class="k">typename</span> <span class="n">T</span><span class="p">,</span> <span class="k">typename</span> <span class="n">N</span><span class="o">></span>
|
||||||
|
<span class="kt">void</span> <span class="k">operator</span><span class="p">()(</span><span class="n">async_traverse_detach_tag</span><span class="p">,</span> <span class="n">T</span><span class="o">&&</span> <span class="n">element</span><span class="p">,</span> <span class="n">N</span><span class="o">&&</span> <span class="n">next</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="k">template</span> <span class="o"><</span><span class="k">typename</span> <span class="n">T</span><span class="o">></span>
|
||||||
|
<span class="kt">void</span> <span class="k">operator</span><span class="p">()(</span><span class="n">async_traverse_complete_tag</span><span class="p">,</span> <span class="n">T</span><span class="o">&&</span> <span class="n">pack</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="p">};</span></pre><aside class="m-note m-default"><h4>Since</h4><p>3.0.0</p></aside><p>See <code>traverse_pack</code> for a detailed description about the traversal behaviour and capabilities.</p>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="gace27f8127eb5eba0f4ab753daacf6a57"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Mapper, typename... T>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">decltype(auto) </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#gace27f8127eb5eba0f4ab753daacf6a57" class="m-dox-self">map_pack</a>(</span><span class="m-dox-wrap">Mapper&& mapper,
|
||||||
|
T&&... pack)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Maps the pack with the given mapper.</p>
|
||||||
|
<table class="m-table m-fullwidth m-flat">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="2">Parameters</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 1%">mapper</td>
|
||||||
|
<td>A callable object, which accept an arbitrary type and maps it to another type or the same one.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>pack</td>
|
||||||
|
<td>An arbitrary variadic pack which may contain any type.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Returns</th>
|
||||||
|
<td>The mapped element or in case the pack contains multiple elements, the pack is wrapped into a <code>std::tuple</code>.</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<p>This function tries to visit all plain elements which may be wrapped in:</p><ul><li>homogeneous containers (<code>std::vector</code>, <code>std::list</code>)</li><li>heterogenous containers <code>(std::tuple</code>, <code>std::pair</code>, <code>std::array</code>) and re-assembles the pack with the result of the mapper. Mapping from one type to a different one is supported.</li></ul><p>Elements that aren't accepted by the mapper are routed through and preserved through the hierarchy.</p><pre class="m-code"><span class="c1">// Maps all integers to floats</span>
|
||||||
|
<span class="n">map_pack</span><span class="p">([](</span><span class="kt">int</span> <span class="n">value</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">return</span> <span class="kt">float</span><span class="p">(</span><span class="n">value</span><span class="p">);</span>
|
||||||
|
<span class="p">},</span>
|
||||||
|
<span class="mi">1</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o"><</span><span class="kt">int</span><span class="o">></span><span class="p">{</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">}),</span> <span class="mi">5</span><span class="p">);</span></pre><aside class="m-note m-default"><h4>Since</h4><p>3.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="ga7c14358f4d11803b50ab9687dfcb11c5"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename... T>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">detail::traversal::spreading::spread_box<std::decay_t<T>...> </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#ga7c14358f4d11803b50ab9687dfcb11c5" class="m-dox-self">spread_this</a>(</span><span class="m-dox-wrap">T&&... args) <span class="m-label m-primary">constexpr</span></span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Indicate that the result shall be spread across the parent container if possible. This can be used to create a mapper function used in map_pack that maps one element to an arbitrary count (1:n).</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>3.0.0</p></aside>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="gab497ec8ef4cf8532703fcb9852846a2e"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename Mapper, typename... T>
|
||||||
|
</div>
|
||||||
|
<span class="m-dox-wrap-bumper">void </span><span class="m-dox-wrap"><span class="m-dox-wrap-bumper"><a href="#gab497ec8ef4cf8532703fcb9852846a2e" class="m-dox-self">traverse_pack</a>(</span><span class="m-dox-wrap">Mapper&& mapper,
|
||||||
|
T&&... pack)</span></span>
|
||||||
|
</h3>
|
||||||
|
<p>Traverses the pack with the given visitor.</p>
|
||||||
|
<p>This function works in the same way as <code>map_pack</code>, however, the result of the mapper isn't preserved.</p><p>See <code>map_pack</code> for a detailed description.</p><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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
226
group___types.html
Normal file
226
group___types.html
Normal file
@ -0,0 +1,226 @@
|
|||||||
|
<!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>Types 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">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" id="m-navbar-current">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>
|
||||||
|
Types <span class="m-thin">module</span></h1>
|
||||||
|
<p>provides the <a href="group___types.html#ga7c8df37fa79b1da94a876e8fc590783c" class="m-dox">continuable</a> and <a href="group___types.html#ga73e58e7558ecf3bd885cb2381160a582" class="m-dox">promise</a> facility for type erasure.</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>
|
||||||
|
</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<template<std::size_t, typename...> class CallbackWrapper, template<std::size_t, typename...> class ContinuationWrapper, typename... Args></div>
|
||||||
|
class <a href="classcti_1_1continuable__trait.html" class="m-dox">cti::continuable_trait</a>
|
||||||
|
</dt>
|
||||||
|
<dd>Trait to retrieve a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> type with a given type-erasure backend.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section id="typedef-members">
|
||||||
|
<h2><a href="#typedef-members">Typedefs</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename... Args></div>
|
||||||
|
using <a href="#ga7c8df37fa79b1da94a876e8fc590783c" class="m-dox">continuable</a> = typename detail::unique_trait_of<Args...>::continuable
|
||||||
|
</dt>
|
||||||
|
<dd>Defines a non-copyable continuation type which uses the function2 backend for type erasure.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename... Args></div>
|
||||||
|
using <a href="#ga73e58e7558ecf3bd885cb2381160a582" class="m-dox">promise</a> = typename detail::unique_trait_of<Args...>::promise
|
||||||
|
</dt>
|
||||||
|
<dd>Defines a non-copyable promise type which is using the function2 backend for type erasure.</dd>
|
||||||
|
<dt>
|
||||||
|
using <a href="#ga3067ad3b42db5e89a87b9f8f19e104b4" class="m-dox">work</a> = detail::work
|
||||||
|
</dt>
|
||||||
|
<dd>Defines a non-copyable type erasure which is capable of carrying callable objects passed to executors.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<h2>Typedef documentation</h2>
|
||||||
|
<section class="m-dox-details" id="ga7c8df37fa79b1da94a876e8fc590783c"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename... Args>
|
||||||
|
</div>
|
||||||
|
using <a href="#ga7c8df37fa79b1da94a876e8fc590783c" class="m-dox-self">continuable</a> = typename detail::unique_trait_of<Args...>::continuable
|
||||||
|
</h3>
|
||||||
|
<p>Defines a non-copyable continuation type which uses the function2 backend for type erasure.</p>
|
||||||
|
<p>Usable like: <code>continuable<int, float></code></p>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="ga73e58e7558ecf3bd885cb2381160a582"><div>
|
||||||
|
<h3>
|
||||||
|
<div class="m-dox-template">
|
||||||
|
template<typename... Args>
|
||||||
|
</div>
|
||||||
|
using <a href="#ga73e58e7558ecf3bd885cb2381160a582" class="m-dox-self">promise</a> = typename detail::unique_trait_of<Args...>::promise
|
||||||
|
</h3>
|
||||||
|
<p>Defines a non-copyable promise type which is using the function2 backend for type erasure.</p>
|
||||||
|
<p>Usable like: <code>promise<int, float></code></p>
|
||||||
|
</div></section>
|
||||||
|
<section class="m-dox-details" id="ga3067ad3b42db5e89a87b9f8f19e104b4"><div>
|
||||||
|
<h3>
|
||||||
|
using <a href="#ga3067ad3b42db5e89a87b9f8f19e104b4" class="m-dox-self">work</a> = detail::work
|
||||||
|
</h3>
|
||||||
|
<p>Defines a non-copyable type erasure which is capable of carrying callable objects passed to executors.</p>
|
||||||
|
<aside class="m-note m-default"><h4>Since</h4><p>3.1.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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
3
highlight.min.js
vendored
Normal file
3
highlight.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
170
index.html
Normal file
170
index.html
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
<!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>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">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">
|
||||||
|
<div class="terminal">
|
||||||
|
<div class="fakeMenu">
|
||||||
|
<div class="fakeButtons fakeClose"></div>
|
||||||
|
<div class="fakeButtons fakeMinimize"></div>
|
||||||
|
<div class="fakeButtons fakeZoom"></div>
|
||||||
|
</div>
|
||||||
|
<div class="fakeScreen">
|
||||||
|
<pre><code id="typedterminal" class="cpp"></code></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</br>
|
||||||
|
|
||||||
|
<script src="typed.js"></script>
|
||||||
|
<script src="highlight.min.js"></script>
|
||||||
|
<script src="terminal.js"></script>
|
||||||
|
|
||||||
|
<section id="mainpage-overview"><h2><a href="#mainpage-overview">Overview</a></h2><p><strong>Continuable is a C++14 library that provides full support for:</strong></p><ul><li>lazy async continuation chaining based on <strong>callbacks</strong> (<a href="classcti_1_1continuable__base.html#adf02030d7211ffc4610f3bcb13d2a149" class="m-dox">then</a>) and expression templates, callbacks are wrapped nicely as <a href="classcti_1_1promise__base.html" class="m-dox">promises</a>.</li><li><strong>no enforced type-erasure</strong> which means we need <strong>less heap allocations</strong> than comparable libraries, strictly following the <strong>"don't
|
||||||
|
pay for what you don't use"</strong> principle.</li><li>support for <strong>all, any and sequential connections</strong> between continuables through expressive operator overloads <a href="classcti_1_1continuable__base.html#a43ad4bfb19234a7856972d97337498db" class="m-dox">&&</a>, <a href="classcti_1_1continuable__base.html#ada74584fb95bf00a50d05072e933c144" class="m-dox">||</a> and <a href="classcti_1_1continuable__base.html#abaaaf8a35827456fead299851268760e" class="m-dox">>></a> as well as free functions <a href="group___connections.html#gaef652b8561f76cad49e83cfa21a71734" class="m-dox">when_<wbr />all</a>, <a href="group___connections.html#ga313760e876d0cbc766b41f6b192544bb" class="m-dox">when_<wbr />any</a> and <a href="group___connections.html#ga481c31024079b6074617c64b16e615dd" class="m-dox">when_<wbr />seq</a>.</li><li>asynchronous <a href="classcti_1_1continuable__base.html#a7001122101ed32f729e39c53d6cb9c7f" class="m-dox">error handling</a> through <a href="classcti_1_1promise__base.html#a609a8cd2ccd43010b154ee0be6165be1" class="m-dox">exceptions</a>, <a href="configuration.html" class="m-dox">error codes</a> and <a href="configuration.html" class="m-dox">user defined types</a>.</li><li><strong>syntactic sugar</strong> for instance: <strong>partial invocation</strong>, <strong>tuple unpacking</strong>, <code>co_await</code> support and <a href="classcti_1_1continuable__base.html#adf02030d7211ffc4610f3bcb13d2a149" class="m-dox">executors</a>.</li><li><strong>encapsuled from any runtime</strong>, larger framework or executors makes it possible to use continuable even in smaller or esoteric usage scenarios.</li></ul></section><section id="mainpage-getting-started"><h2><a href="#mainpage-getting-started">Getting started</a></h2><p>Continuable is a header-only library with zero compilation dependencies. The <a href="installation.html" class="m-dox">Installation</a> and <a href="configuration.html" class="m-dox">Configuration</a> are explained in its own chapter.</p><p>The <a href="tutorial.html" class="m-dox">Tutorial</a> is everything you need in order to get to know the libraries API. Beside of this, there is a detailed in-source documentation provided.</p><p>Continuable follows the semantic versioning schema and changes are listed in the <a href="changelog.html" class="m-dox">Changelog</a>.</p></section><section id="mainpage-contact"><h2><a href="#mainpage-contact">Contributing and Questions</a></h2><p>Through the <a href="https://github.com/Naios/continuable/issues">Github issue tracker</a> you are welcomed to ask for questions, contribute code or request new features. Also I would like to hear your personal opinion about the library design or your personal experience in using the library to improve it.</p><aside class="m-note m-warning"><h4>Attention</h4><p>If you like the library I would be glad if you star it on Github, because it helps other users to find this library.</p></aside><aside class="m-note m-info"><h4>Note</h4><p>If you are using the library in your open-source or commercial project I would highly appreciate if you could give me a short notice so I can add you to a list of projects and companies using this library.</p></aside></section><section id="mainpage-license"><h2><a href="#mainpage-license">License</a></h2><p>Continuable is licensed under the MIT license:</p><blockquote><p>Copyright(c) 2015 - 2018 Denis Blank <denis.blank at outlook dot com></p><p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :</p><p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p><p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p></blockquote></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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
184
installation.html
Normal file
184
installation.html
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
<!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>Installation | 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" id="m-navbar-current">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">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>
|
||||||
|
Installation
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p>An explanation on how to install continuable on various platforms.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#installation-requirements">Requirements</a></li>
|
||||||
|
<li><a href="#installation-dependencies">Dependencies</a></li>
|
||||||
|
<li>
|
||||||
|
<a href="#installation-installation">Installation</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#installation-installation-cmake">Through CMake</a></li>
|
||||||
|
<li><a href="#installation-installation-pkg">Through package managers</a></li>
|
||||||
|
<li><a href="#installation-installation-amalgamation">By using the amalgamation header</a></li>
|
||||||
|
<li><a href="#installation-installation-copy">By copying the headers</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href="#installation-unit-tests">Building the unit tests</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<section id="installation-requirements"><h2><a href="#installation-requirements">Requirements</a></h2><p>Continuable requires a fairly new toolchain and was verified to work with following compilers:</p><ul><li>Visual Studio 2017+ Update 2</li><li>Clang 5.0+</li><li>GCC 6.0+</li></ul><p>Although the build is observed with the listed compilers earlier versions might work.</p><aside class="m-note m-danger"><h4>Warning</h4><p>GCC is proven to be slower than Clang in template compilation and thus it is suggested to use Clang instead.</p></aside></section><section id="installation-dependencies"><h2><a href="#installation-dependencies">Dependencies</a></h2><p>Continuable is a header-only library with one required header-only dependency:</p><ul><li><a href="https://github.com/Naios/function2">Naios/<wbr />function2</a> is used as type erasure wrapper to convert a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> into a <a href="group___types.html#ga7c8df37fa79b1da94a876e8fc590783c" class="m-dox">continuable</a>.</li></ul><p>Additionally GTest is required as optional dependency for the asynchronous unit testing macros defined in <code><a href="continuable-testing_8hpp.html" class="m-dox">continuable/<wbr />continuable-testing.hpp</a></code> if those are used:</p><ul><li><a href="https://github.com/google/googletest">google/<wbr />googletest</a> is used as unit testing framework and to provide asynchronous testing macros.</li></ul><p>For the examples and unit tests there might be more dependencies used, which are fetched through git submodules.</p><aside class="m-note m-info"><h4>Note</h4><p>The library only depends on the standard library when following headers are used:</p><ul><li><code><a href="continuable-base_8hpp.html" class="m-dox">continuable/<wbr />continuable-base.hpp</a></code></li><li><code><a href="continuable-promise-base_8hpp.html" class="m-dox">continuable/<wbr />continuable-promise-base.hpp</a></code></li><li><code><a href="continuable-connections_8hpp.html" class="m-dox">continuable/<wbr />continuable-connections.hpp</a></code></li><li><code><a href="continuable-promisify_8hpp.html" class="m-dox">continuable/<wbr />continuable-promisify.hpp</a></code></li><li><code><a href="continuable-transforms_8hpp.html" class="m-dox">continuable/<wbr />continuable-transforms.hpp</a></code></li></ul></aside></section><section id="installation-installation"><h2><a href="#installation-installation">Installation</a></h2><p>Making continuable available inside your project is possible through various ways.</p><section id="installation-installation-cmake"><h3><a href="#installation-installation-cmake">Through CMake</a></h3><p>The continuable build is driven by CMake and the project exposes CMake interface targets when being used by external projects:</p><pre class="m-code"><span class="nb">add_subdirectory</span><span class="p">(</span><span class="s">continuable</span><span class="p">)</span>
|
||||||
|
<span class="c"># continuable provides an interface target which makes it's</span>
|
||||||
|
<span class="c"># headers available to all projects using the continuable library.</span>
|
||||||
|
<span class="nb">target_link_libraries</span><span class="p">(</span><span class="s">my_project</span> <span class="s">continuable</span><span class="p">)</span></pre><p>When adding the continuable subdirectory as git submodule this should work out of the box.</p><pre class="m-code">git submodule add https://github.com/Naios/continuable.git</pre><aside class="m-note m-warning"><h4>Attention</h4><p>On POSIX platforms you are required to link your application against a corresponding thread library, otherwise <code>std::futures</code> won't work properly, this is done automatically by the provided CMake project.</p></aside><p>Additionally the CMake project exports a <code>continuable</code> target which is importable through the <code class="m-code"><span class="err">find_package</span></code> CMake command when installed:</p><pre class="m-code">mkdir build
|
||||||
|
<span class="nb">cd</span> build
|
||||||
|
cmake ..
|
||||||
|
cmake --build . --target INSTALL --config Release</pre><p>In your <code>CMakeLists.txt</code>:</p><pre class="m-code"><span class="nb">find_package</span><span class="p">(</span><span class="s">continuable</span> <span class="s">REQUIRED</span><span class="p">)</span></pre></section><section id="installation-installation-pkg"><h3><a href="#installation-installation-pkg">Through package managers</a></h3><p>Continuable is present in some package managers and registries already, and might be installed from there.</p><aside class="m-note m-warning"><h4>Attention</h4><p>The project is still looking for contributions that would help to make it available from various package managers in order to make the installation easier.</p></aside></section><section id="installation-installation-amalgamation"><h3><a href="#installation-installation-amalgamation">By using the amalgamation header</a></h3><p>For major versions there is an amalgamation header provided which can be included without any dependency:</p><ul><li><a href="https://gist.githubusercontent.com/Naios/b128ab5028a7eb33e4285c0293573d9f/raw/79fe332964a786b21a8661ef65d07a5669260a3c/continuable.hpp">3.0.0</a></li></ul></section><section id="installation-installation-copy"><h3><a href="#installation-installation-copy">By copying the headers</a></h3><p>If you don't want to rely on CMake or package managers it is possible to copy and include the <code>include</code> directories of continuable and <a href="https://github.com/Naios/function2">Naios/<wbr />function2</a> into your project.</p><p>As an improvement git submodules could be used:</p><pre class="m-code">git submodule add https://github.com/Naios/continuable.git
|
||||||
|
git submodule add https://github.com/Naios/function2.git</pre></section></section><section id="installation-unit-tests"><h2><a href="#installation-unit-tests">Building the unit tests</a></h2><p>In order to build the unit tests clone the repository recursively with all submodules:</p><pre class="m-code"><span class="c1"># Shell:</span>
|
||||||
|
git clone --recursive https://github.com/Naios/continuable.git</pre><p>Then CMake can be used to generate a project solution for testing.</p></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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
2098
m-dark+doxygen.compiled.css
Normal file
2098
m-dark+doxygen.compiled.css
Normal file
File diff suppressed because it is too large
Load Diff
177
modules.html
Normal file
177
modules.html
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
<!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>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" id="m-navbar-current">Modules</a>
|
||||||
|
<ol>
|
||||||
|
<li><a href="group___base.html">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>Modules</h2>
|
||||||
|
<ul class="m-dox">
|
||||||
|
<li>module <a href="group___base.html" class="m-dox">Base</a> <span class="m-dox">provides classes and functions to create <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects.</span></li>
|
||||||
|
<li>module <a href="group___connections.html" class="m-dox">Connections</a> <span class="m-dox">provides functions to connect <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />bases</a> through various strategies.</span></li>
|
||||||
|
<li>module <a href="group___promisify.html" class="m-dox">Promisify</a> <span class="m-dox">provides helper methods to convert various callback styles to <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />bases</a>.</span></li>
|
||||||
|
<li>module <a href="group___testing.html" class="m-dox">Testing</a> <span class="m-dox">provides macro shortcuts for testing asynchronous continuations through GTest.</span></li>
|
||||||
|
<li>module <a href="group___types.html" class="m-dox">Types</a> <span class="m-dox">provides the <a href="group___types.html#ga7c8df37fa79b1da94a876e8fc590783c" class="m-dox">continuable</a> and <a href="group___types.html#ga73e58e7558ecf3bd885cb2381160a582" class="m-dox">promise</a> facility for type erasure.</span></li>
|
||||||
|
<li>module <a href="group___transforms.html" class="m-dox">Transforms</a> <span class="m-dox">provides utilities to convert <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />bases</a> to other types such as (<code>std::future</code>).</span></li>
|
||||||
|
<li>module <a href="group___traversal.html" class="m-dox">Traversal</a> <span class="m-dox">provides functions to traverse and remap nested packs.</span></li>
|
||||||
|
</ul>
|
||||||
|
<script>
|
||||||
|
function toggle(e) {
|
||||||
|
e.parentElement.className = e.parentElement.className == 'm-dox-collapsible' ?
|
||||||
|
'm-dox-expansible' : 'm-dox-collapsible';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Collapse all nodes marked as such. Doing it via JS instead of directly in
|
||||||
|
markup so disabling it doesn't harm usability. The list is somehow
|
||||||
|
regenerated on every iteration and shrinks as I change the classes. It's not
|
||||||
|
documented anywhere and I'm not sure if this is the same across browsers, so
|
||||||
|
I am going backwards in that list to be sure. */
|
||||||
|
var collapsed = document.getElementsByClassName("collapsed");
|
||||||
|
for(var i = collapsed.length - 1; i >= 0; --i)
|
||||||
|
collapsed[i].className = 'm-dox-expansible';
|
||||||
|
</script>
|
||||||
|
</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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
354
namespacecti.html
Normal file
354
namespacecti.html
Normal file
@ -0,0 +1,354 @@
|
|||||||
|
<!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>cti namespace | 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">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" id="m-navbar-current">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>cti <span class="m-thin">namespace</span></h1>
|
||||||
|
<p>Declares the continuable library namespace.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
Reference
|
||||||
|
<ul>
|
||||||
|
<li><a href="#namespaces">Namespaces</a></li>
|
||||||
|
<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>
|
||||||
|
<p>The most important class is <a href="classcti_1_1continuable__base.html" class="m-dox">cti::<wbr />continuable_base</a>, that provides the whole functionality for continuation chaining.</p><p>The class <a href="classcti_1_1continuable__base.html" class="m-dox">cti::<wbr />continuable_base</a> is created through the <a href="group___base.html#gaf47869ea139d88976af5b9654d6d61c0" class="m-dox">cti::<wbr />make_continuable()</a> function which accepts a callback taking function.</p><p>Also there are following support functions available:</p><ul><li><a href="group___connections.html#gaef652b8561f76cad49e83cfa21a71734" class="m-dox">cti::<wbr />when_all()</a> - connects <a href="classcti_1_1continuable__base.html" class="m-dox">cti::<wbr />continuable_base</a>'s to an <code>all</code> connection.</li><li><a href="group___connections.html#ga313760e876d0cbc766b41f6b192544bb" class="m-dox">cti::<wbr />when_any()</a> - connects <a href="classcti_1_1continuable__base.html" class="m-dox">cti::<wbr />continuable_base</a>'s to an <code>any</code> connection.</li><li><a href="group___connections.html#ga481c31024079b6074617c64b16e615dd" class="m-dox">cti::<wbr />when_seq()</a> - connects <a href="classcti_1_1continuable__base.html" class="m-dox">cti::<wbr />continuable_base</a>'s to a sequence.</li></ul>
|
||||||
|
<section id="namespaces">
|
||||||
|
<h2><a href="#namespaces">Namespaces</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>namespace <a href="namespacecti_1_1transforms.html" class="m-dox">transforms</a></dt>
|
||||||
|
<dd>The namespace transforms declares callable objects that transform any <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> to an object or to a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> itself.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section id="nested-classes">
|
||||||
|
<h2><a href="#nested-classes">Classes</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Data, typename Annotation></div>
|
||||||
|
class <a href="classcti_1_1continuable__base.html" class="m-dox">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<template<std::size_t, typename...> class CallbackWrapper, template<std::size_t, typename...> class ContinuationWrapper, typename... Args></div>
|
||||||
|
class <a href="classcti_1_1continuable__trait.html" class="m-dox">continuable_trait</a>
|
||||||
|
</dt>
|
||||||
|
<dd>Trait to retrieve a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> type with a given type-erasure backend.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Data, typename Hint></div>
|
||||||
|
class <a href="classcti_1_1promise__base.html" class="m-dox">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's result or through an error type.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename... Result></div>
|
||||||
|
class <a href="classcti_1_1promisify.html" class="m-dox">promisify</a>
|
||||||
|
</dt>
|
||||||
|
<dd>Helper class for converting callback taking callable types into a a continuable. Various styles are supported.</dd>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section id="typedef-members">
|
||||||
|
<h2><a href="#typedef-members">Typedefs</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
using <a href="group___base.html#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="group___base.html#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<typename T></div>
|
||||||
|
using <a href="group___base.html#gabe4e73c301a2697d9252c400194474e0" class="m-dox">is_continuable</a> = detail::base::is_continuable<T>
|
||||||
|
</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>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename T></div>
|
||||||
|
using <a href="group___transforms.html#gad64ab92505da9dbc999ecc6f964d47c2" class="m-dox">transform</a> = detail::types::transform<T>
|
||||||
|
</dt>
|
||||||
|
<dd>A callable tag object which marks a wrapped callable object as continuable transformation which enables some useful overloads.</dd>
|
||||||
|
<dt>
|
||||||
|
using <a href="group___traversal.html#ga170b41a7aacd94036f9da0af42c6558d" class="m-dox">async_traverse_visit_tag</a> = detail::traversal::async_traverse_visit_tag
|
||||||
|
</dt>
|
||||||
|
<dd>A tag which is passed to the <code>operator()</code> of the visitor if an element is visited synchronously through <a href="group___traversal.html#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_<wbr />pack_<wbr />async</a>.</dd>
|
||||||
|
<dt>
|
||||||
|
using <a href="group___traversal.html#gacc6d0dce8126550436303d433c96b1d7" class="m-dox">async_traverse_detach_tag</a> = detail::traversal::async_traverse_detach_tag
|
||||||
|
</dt>
|
||||||
|
<dd>A tag which is passed to the <code>operator()</code> of the visitor if an element is visited after the traversal was detached through <a href="group___traversal.html#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_<wbr />pack_<wbr />async</a>.</dd>
|
||||||
|
<dt>
|
||||||
|
using <a href="group___traversal.html#ga1c9f6c5ba9ffb68ff36a1f95b78e7d3a" class="m-dox">async_traverse_complete_tag</a> = detail::traversal::async_traverse_complete_tag
|
||||||
|
</dt>
|
||||||
|
<dd>A tag which is passed to the <code>operator()</code> of the visitor if the asynchronous pack traversal was finished through <a href="group___traversal.html#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_<wbr />pack_<wbr />async</a>.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename T></div>
|
||||||
|
using <a href="group___traversal.html#gaf67b511265fa74dc4b117cdb1ce9d1e3" class="m-dox">async_traverse_in_place_tag</a> = detail::traversal::async_traverse_in_place_tag<T>
|
||||||
|
</dt>
|
||||||
|
<dd>A tag to identify that a mapper shall be constructed in-place from the first argument passed to <a href="group___traversal.html#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_<wbr />pack_<wbr />async</a>.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename... Args></div>
|
||||||
|
using <a href="group___types.html#ga7c8df37fa79b1da94a876e8fc590783c" class="m-dox">continuable</a> = typename <a href="classcti_1_1continuable__trait.html" class="m-dox">detail::<wbr />unique_trait_of</a><Args...>::<a href="group___types.html#ga7c8df37fa79b1da94a876e8fc590783c" class="m-dox">continuable</a>
|
||||||
|
</dt>
|
||||||
|
<dd>Defines a non-copyable continuation type which uses the function2 backend for type erasure.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename... Args></div>
|
||||||
|
using <a href="group___types.html#ga73e58e7558ecf3bd885cb2381160a582" class="m-dox">promise</a> = typename <a href="classcti_1_1continuable__trait.html" class="m-dox">detail::<wbr />unique_trait_of</a><Args...>::<a href="group___types.html#ga73e58e7558ecf3bd885cb2381160a582" class="m-dox">promise</a>
|
||||||
|
</dt>
|
||||||
|
<dd>Defines a non-copyable promise type which is using the function2 backend for type erasure.</dd>
|
||||||
|
<dt>
|
||||||
|
using <a href="group___types.html#ga3067ad3b42db5e89a87b9f8f19e104b4" class="m-dox">work</a> = detail::work
|
||||||
|
</dt>
|
||||||
|
<dd>Defines a non-copyable type erasure which is capable of carrying callable objects passed to executors.</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<typename... Args, typename Continuation></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___base.html#gaf47869ea139d88976af5b9654d6d61c0" class="m-dox">make_continuable</a>(</span><span class="m-dox-wrap">Continuation&& continuation) -> 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<typename... Args></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___base.html#gaa638513fe4c0a80b9ad445f8dff91250" class="m-dox">make_ready_continuable</a>(</span><span class="m-dox-wrap">) -> 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<typename Result></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___base.html#gaad3c8cc144f08d8d3614651ae36f7106" class="m-dox">make_ready_continuable</a>(</span><span class="m-dox-wrap">Result&& result) -> 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<typename FirstResult, typename SecondResult, typename... Rest></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___base.html#gade7f394af50a956c2516bffc29410a9d" class="m-dox">make_ready_continuable</a>(</span><span class="m-dox-wrap">FirstResult&& first_result,
|
||||||
|
SecondResult&& second_result,
|
||||||
|
Rest&&... rest) -> 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<typename... Signature, typename Exception></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___base.html#ga41794c321aef916f4fd0fe4c36aa9e6e" class="m-dox">make_exceptional_continuable</a>(</span><span class="m-dox-wrap">Exception&& exception) -> 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>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename... Args></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___connections.html#gaef652b8561f76cad49e83cfa21a71734" class="m-dox">when_all</a>(</span><span class="m-dox-wrap">Args&&... args) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Connects the given arguments with an all logic. All continuables contained inside the given nested pack are invoked at once. On completion the final handler is called with the aggregated result of all continuables.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Iterator, std::enable_if_t<detail::range::is_iterator<Iterator>::value>* = nullptr></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___connections.html#gaa39f871e8aa99953dc83fda92b449024" class="m-dox">when_all</a>(</span><span class="m-dox-wrap">Iterator begin,
|
||||||
|
Iterator end) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Connects the given arguments with an all logic. The content of the iterator is moved out and converted to a temporary <code>std::vector</code> which is then passed to when_all.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename... Args></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___connections.html#ga481c31024079b6074617c64b16e615dd" class="m-dox">when_seq</a>(</span><span class="m-dox-wrap">Args&&... args) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Connects the given arguments with a sequential logic. All continuables contained inside the given nested pack are invoked one after one. On completion the final handler is called with the aggregated result of all continuables.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Iterator, std::enable_if_t<detail::range::is_iterator<Iterator>::value>* = nullptr></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___connections.html#ga1d52caeca48122b5aebb276d0d47805a" class="m-dox">when_seq</a>(</span><span class="m-dox-wrap">Iterator begin,
|
||||||
|
Iterator end) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Connects the given arguments with a sequential logic. The content of the iterator is moved out and converted to a temporary <code>std::vector</code> which is then passed to when_seq.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename... Args></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___connections.html#ga313760e876d0cbc766b41f6b192544bb" class="m-dox">when_any</a>(</span><span class="m-dox-wrap">Args&&... args) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Connects the given arguments with an any logic. All continuables contained inside the given nested pack are invoked at once. On completion of one continuable the final handler is called with the result of the resolved continuable.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Iterator, std::enable_if_t<detail::range::is_iterator<Iterator>::value>* = nullptr></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___connections.html#ga580b6b0d4fd31371b2f37e0dc5bf039b" class="m-dox">when_any</a>(</span><span class="m-dox-wrap">Iterator begin,
|
||||||
|
Iterator end) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Connects the given arguments with an any logic. The content of the iterator is moved out and converted to a temporary <code>std::vector</code> which is then passed to when_all.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<template<typename, typename> class C = std::vector, typename First, typename... Args></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___connections.html#ga4f6ecedf4b4ccd5e1c28d937ad717b32" class="m-dox">populate</a>(</span><span class="m-dox-wrap">First&& first,
|
||||||
|
Args&&... args) -> C<std::decay_t<First>, std::allocator<std::decay_t<First>>></span>
|
||||||
|
</dt>
|
||||||
|
<dd>Populates a homogeneous container from the given arguments. All arguments need to be convertible to the first one, by default <code>std::vector</code> is used as container type.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename T></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___transforms.html#ga2383cf2e4cf7d8d43efeb25f790be006" class="m-dox">make_transform</a>(</span><span class="m-dox-wrap">T&& callable) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Wraps the given callable object into a transform class.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Visitor, typename... T></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___traversal.html#ga02922d0c5bf7a18340069b3500a0cf90" class="m-dox">traverse_pack_async</a>(</span><span class="m-dox-wrap">Visitor&& visitor,
|
||||||
|
T&&... pack) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Traverses the pack with the given visitor in an asynchronous way.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Mapper, typename... T></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___traversal.html#gace27f8127eb5eba0f4ab753daacf6a57" class="m-dox">map_pack</a>(</span><span class="m-dox-wrap">Mapper&& mapper,
|
||||||
|
T&&... pack) -> decltype(auto)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Maps the pack with the given mapper.</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename... T></div>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___traversal.html#ga7c14358f4d11803b50ab9687dfcb11c5" class="m-dox">spread_this</a>(</span><span class="m-dox-wrap">T&&... args) -> detail::traversal::spreading::spread_box<std::decay_t<T>...> <span class="m-label m-flat m-primary">constexpr</span></span>
|
||||||
|
</dt>
|
||||||
|
<dd>Indicate that the result shall be spread across the parent container if possible. This can be used to create a mapper function used in map_pack that maps one element to an arbitrary count (1:n).</dd>
|
||||||
|
<dt>
|
||||||
|
<div class="m-dox-template">template<typename Mapper, typename... T></div>
|
||||||
|
<span class="m-dox-wrap-bumper">void <a href="group___traversal.html#gab497ec8ef4cf8532703fcb9852846a2e" class="m-dox">traverse_pack</a>(</span><span class="m-dox-wrap">Mapper&& mapper,
|
||||||
|
T&&... pack)</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Traverses the pack with the given visitor.</dd>
|
||||||
|
</dl>
|
||||||
|
</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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
179
namespacecti_1_1transforms.html
Normal file
179
namespacecti_1_1transforms.html
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
<!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>cti::transforms namespace | 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">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" id="m-navbar-current">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><span class="m-breadcrumb"><a href="namespacecti.html">cti</a>::</span>transforms <span class="m-thin">namespace</span></h1>
|
||||||
|
<p>The namespace transforms declares callable objects that transform any <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> to an object or to a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> itself.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
Reference
|
||||||
|
<ul>
|
||||||
|
<li><a href="#func-members">Functions</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<p>Transforms can be applied to continuables through using the <a href="classcti_1_1continuable__base.html#abcf4cf105aa17826bcc3c2278f6ea1b5" class="m-dox">cti::<wbr />continuable_base::<wbr />apply</a> method accordingly.</p>
|
||||||
|
<section id="func-members">
|
||||||
|
<h2><a href="#func-members">Functions</a></h3>
|
||||||
|
<dl class="m-dox">
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___transforms.html#gac698fd2486d980302cbd956fdeafdfde" class="m-dox">futurize</a>(</span><span class="m-dox-wrap">) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Returns a transform that if applied to a continuable, it will start the continuation chain and returns the asynchronous result as <code>std::future<...></code>.</dd>
|
||||||
|
<dt>
|
||||||
|
<span class="m-dox-wrap-bumper">auto <a href="group___transforms.html#ga9b0b1ba047ea018c7f211ea14c6d2a64" class="m-dox">flatten</a>(</span><span class="m-dox-wrap">) -> auto</span>
|
||||||
|
</dt>
|
||||||
|
<dd>Returns a transform that if applied to a continuable, it will ignores all error which ocured until the point the transform was applied.</dd>
|
||||||
|
</dl>
|
||||||
|
</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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
177
namespaces.html
Normal file
177
namespaces.html
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
<!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>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">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>Namespaces</h2>
|
||||||
|
<ul class="m-dox">
|
||||||
|
<li class="m-dox-collapsible">
|
||||||
|
<a href="#" onclick="return toggle(this)">namespace</a> <a href="namespacecti.html" class="m-dox">cti</a> <span class="m-dox">Declares the continuable library namespace.</span>
|
||||||
|
<ul class="m-dox">
|
||||||
|
<li>namespace <a href="namespacecti_1_1transforms.html" class="m-dox">transforms</a> <span class="m-dox">The namespace transforms declares callable objects that transform any <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> to an object or to a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> itself.</span></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<script>
|
||||||
|
function toggle(e) {
|
||||||
|
e.parentElement.className = e.parentElement.className == 'm-dox-collapsible' ?
|
||||||
|
'm-dox-expansible' : 'm-dox-collapsible';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Collapse all nodes marked as such. Doing it via JS instead of directly in
|
||||||
|
markup so disabling it doesn't harm usability. The list is somehow
|
||||||
|
regenerated on every iteration and shrinks as I change the classes. It's not
|
||||||
|
documented anywhere and I'm not sure if this is the same across browsers, so
|
||||||
|
I am going backwards in that list to be sure. */
|
||||||
|
var collapsed = document.getElementsByClassName("collapsed");
|
||||||
|
for(var i = collapsed.length - 1; i >= 0; --i)
|
||||||
|
collapsed[i].className = 'm-dox-expansible';
|
||||||
|
</script>
|
||||||
|
</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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
185
pages.html
Normal file
185
pages.html
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
<!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>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" id="m-navbar-current">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">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>Pages</h2>
|
||||||
|
<ul class="m-dox">
|
||||||
|
<li><a href="changelog.html" class="m-dox">Changelog</a> <span class="m-dox">A description of the changes made to continuable.</span></li>
|
||||||
|
<li><a href="configuration.html" class="m-dox">Configuration</a> <span class="m-dox">Covers optional preprocessor macros that change the libraries behaviour.</span></li>
|
||||||
|
<li><a href="installation.html" class="m-dox">Installation</a> <span class="m-dox">An explanation on how to install continuable on various platforms.</span></li>
|
||||||
|
<li class="m-dox-collapsible">
|
||||||
|
<a href="#" onclick="return toggle(this)"></a><a href="tutorial.html" class="m-dox">Tutorial</a> <span class="m-dox">An introduction for using the continuable library.</span>
|
||||||
|
<ul class="m-dox">
|
||||||
|
<li><a href="tutorial-creating-continuables.html" class="m-dox">Creating continuables</a> <span class="m-dox">Explains how to create a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</span></li>
|
||||||
|
<li><a href="tutorial-chaining-continuables.html" class="m-dox">Chaining continuables</a> <span class="m-dox">Explains how to chain multiple <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects together.</span></li>
|
||||||
|
<li><a href="tutorial-connecting-continuables.html" class="m-dox">Connecting continuables</a> <span class="m-dox">Explains how to connect various <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects together.</span></li>
|
||||||
|
<li><a href="tutorial-transforming-continuables.html" class="m-dox">Transforming continuables</a> <span class="m-dox">Explains the conversion into other types such as <code>std::future</code>.</span></li>
|
||||||
|
<li><a href="tutorial-awaiting-continuables.html" class="m-dox">Awaiting continuables</a> <span class="m-dox">Explains how to use the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> together with <code>co_await</code>.</span></li>
|
||||||
|
<li><a href="tutorial-promisify-continuables.html" class="m-dox">Promisify functions</a> <span class="m-dox">Explains how to promisify callback taking functions into a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</span></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<script>
|
||||||
|
function toggle(e) {
|
||||||
|
e.parentElement.className = e.parentElement.className == 'm-dox-collapsible' ?
|
||||||
|
'm-dox-expansible' : 'm-dox-collapsible';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Collapse all nodes marked as such. Doing it via JS instead of directly in
|
||||||
|
markup so disabling it doesn't harm usability. The list is somehow
|
||||||
|
regenerated on every iteration and shrinks as I change the classes. It's not
|
||||||
|
documented anywhere and I'm not sure if this is the same across browsers, so
|
||||||
|
I am going backwards in that list to be sure. */
|
||||||
|
var collapsed = document.getElementsByClassName("collapsed");
|
||||||
|
for(var i = collapsed.length - 1; i >= 0; --i)
|
||||||
|
collapsed[i].className = 'm-dox-expansible';
|
||||||
|
</script>
|
||||||
|
</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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
574
search.js
Normal file
574
search.js
Normal file
@ -0,0 +1,574 @@
|
|||||||
|
/*
|
||||||
|
This file is part of m.css.
|
||||||
|
|
||||||
|
Copyright © 2017, 2018 Vladimír Vondruš <mosra@centrum.cz>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict"; /* it summons the Cthulhu in a proper way, they say */
|
||||||
|
|
||||||
|
var Search = {
|
||||||
|
trie: null,
|
||||||
|
map: null,
|
||||||
|
dataSize: 0,
|
||||||
|
symbolCount: 0,
|
||||||
|
maxResults: 0,
|
||||||
|
|
||||||
|
/* Always contains at least the root node offset and then one node offset
|
||||||
|
per entered character */
|
||||||
|
searchString: '',
|
||||||
|
searchStack: [],
|
||||||
|
|
||||||
|
init: function(buffer, maxResults) {
|
||||||
|
let view = new DataView(buffer);
|
||||||
|
|
||||||
|
/* The file is too short to contain at least the headers */
|
||||||
|
if(view.byteLength < 20) {
|
||||||
|
console.error("Search data too short");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(view.getUint8(0) != 'M'.charCodeAt(0) ||
|
||||||
|
view.getUint8(1) != 'C'.charCodeAt(0) ||
|
||||||
|
view.getUint8(2) != 'S'.charCodeAt(0)) {
|
||||||
|
console.error("Invalid search data signature");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(view.getUint8(3) != 0) {
|
||||||
|
console.error("Invalid search data version");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Separate the data into the trie and the result map */
|
||||||
|
let mapOffset = view.getUint32(6, true);
|
||||||
|
this.trie = new DataView(buffer, 10, mapOffset - 10);
|
||||||
|
this.map = new DataView(buffer, mapOffset);
|
||||||
|
|
||||||
|
/* Set initial properties */
|
||||||
|
this.dataSize = buffer.byteLength;
|
||||||
|
this.symbolCount = view.getUint16(4, true);
|
||||||
|
this.maxResults = maxResults ? maxResults : 100;
|
||||||
|
this.searchString = '';
|
||||||
|
this.searchStack = [this.trie.getUint32(0, true)];
|
||||||
|
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if(typeof document !== 'undefined') {
|
||||||
|
document.getElementById('search-symbolcount').innerHTML =
|
||||||
|
this.symbolCount + " symbols (" + Math.round(this.dataSize/102.4)/10 + " kB)";
|
||||||
|
document.getElementById('search-input').disabled = false;
|
||||||
|
document.getElementById('search-input').placeholder = "Type something here …";
|
||||||
|
document.getElementById('search-input').focus();
|
||||||
|
|
||||||
|
/* Search for the input value (there might be something already,
|
||||||
|
for example when going back in the browser) */
|
||||||
|
let value = document.getElementById('search-input').value;
|
||||||
|
if(value.length) Search.renderResults(value, Search.search(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
download: /* istanbul ignore next */ function(url) {
|
||||||
|
var req = window.XDomainRequest ? new XDomainRequest() : new XMLHttpRequest();
|
||||||
|
if(!req) return;
|
||||||
|
|
||||||
|
req.open("GET", url, true);
|
||||||
|
req.responseType = 'arraybuffer';
|
||||||
|
req.onreadystatechange = function() {
|
||||||
|
if(req.readyState != 4) return;
|
||||||
|
|
||||||
|
Search.init(req.response);
|
||||||
|
}
|
||||||
|
req.send();
|
||||||
|
},
|
||||||
|
|
||||||
|
base85decode: function(base85string) {
|
||||||
|
function charValue(char) {
|
||||||
|
if(char >= 48 && char < 58) /* 0-9 -> 0-9 */
|
||||||
|
return char - 48 + 0;
|
||||||
|
if(char >= 65 && char < 91) /* A-Z -> 10-35 */
|
||||||
|
return char - 65 + 10;
|
||||||
|
if(char >= 97 && char < 123) /* a-z -> 36-61 */
|
||||||
|
return char - 97 + 36;
|
||||||
|
if(char == 33) /* ! -> 62 */
|
||||||
|
return 62;
|
||||||
|
/* skipping 34 (') */
|
||||||
|
if(char >= 35 && char < 39) /* #-& -> 63-66 */
|
||||||
|
return char - 35 + 63;
|
||||||
|
/* skipping 39 (") */
|
||||||
|
if(char >= 40 && char < 44) /* (-+ -> 67-70 */
|
||||||
|
return char - 40 + 67;
|
||||||
|
/* skipping 44 (,) */
|
||||||
|
if(char == 45) /* - -> 71 */
|
||||||
|
return 71;
|
||||||
|
if(char >= 59 && char < 65) /* ;-@ -> 72-77 */
|
||||||
|
return char - 59 + 72;
|
||||||
|
if(char >= 94 && char < 97) /* ^-` -> 78-80 */
|
||||||
|
return char - 94 + 78;
|
||||||
|
if(char >= 123 && char < 127) /* {-~ -> 81-84 */
|
||||||
|
return char - 123 + 81;
|
||||||
|
|
||||||
|
return 0; /* Interpret padding values as zeros */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pad the string for easier decode later. We don't read past the file
|
||||||
|
end, so it doesn't matter what garbage is there. */
|
||||||
|
if(base85string.length % 5) {
|
||||||
|
console.log("Expected properly padded base85 data");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let buffer = new ArrayBuffer(base85string.length*4/5);
|
||||||
|
let data8 = new DataView(buffer);
|
||||||
|
for(let i = 0; i < base85string.length; i += 5) {
|
||||||
|
let char1 = charValue(base85string.charCodeAt(i + 0));
|
||||||
|
let char2 = charValue(base85string.charCodeAt(i + 1));
|
||||||
|
let char3 = charValue(base85string.charCodeAt(i + 2));
|
||||||
|
let char4 = charValue(base85string.charCodeAt(i + 3));
|
||||||
|
let char5 = charValue(base85string.charCodeAt(i + 4));
|
||||||
|
|
||||||
|
data8.setUint32(i*4/5, char5 +
|
||||||
|
char4*85 +
|
||||||
|
char3*85*85 +
|
||||||
|
char2*85*85*85 +
|
||||||
|
char1*85*85*85*85, false); /* BE, yes */
|
||||||
|
}
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
},
|
||||||
|
|
||||||
|
load: function(base85string) {
|
||||||
|
return this.init(this.base85decode(base85string));
|
||||||
|
},
|
||||||
|
|
||||||
|
/* http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html */
|
||||||
|
toUtf8: function(string) { return unescape(encodeURIComponent(string)); },
|
||||||
|
fromUtf8: function(string) { return decodeURIComponent(escape(string)); },
|
||||||
|
|
||||||
|
/* Returns the values in UTF-8, but input is in whatever shitty 16bit
|
||||||
|
encoding JS has */
|
||||||
|
search: function(searchString) {
|
||||||
|
/* Normalize the search string first, convert to UTF-8 */
|
||||||
|
searchString = this.toUtf8(searchString.toLowerCase().trim());
|
||||||
|
|
||||||
|
/* TODO: maybe i could make use of InputEvent.data and others here */
|
||||||
|
|
||||||
|
/* Find longest common prefix of previous and current value so we don't
|
||||||
|
need to needlessly search again */
|
||||||
|
let max = Math.min(searchString.length, this.searchString.length);
|
||||||
|
let commonPrefix = 0;
|
||||||
|
for(; commonPrefix != max; ++commonPrefix)
|
||||||
|
if(searchString[commonPrefix] != this.searchString[commonPrefix]) break;
|
||||||
|
|
||||||
|
/* Drop items off the stack if it has has more than is needed for the
|
||||||
|
common prefix (it needs to have at least one item, though) */
|
||||||
|
if(commonPrefix + 1 < this.searchStack.length)
|
||||||
|
this.searchStack.splice(commonPrefix + 1, this.searchStack.length - commonPrefix - 1);
|
||||||
|
|
||||||
|
/* Add new characters from the search string */
|
||||||
|
let foundPrefix = commonPrefix;
|
||||||
|
for(; foundPrefix != searchString.length; ++foundPrefix) {
|
||||||
|
/* Calculate offset and count of children */
|
||||||
|
let offset = this.searchStack[this.searchStack.length - 1];
|
||||||
|
let relChildOffset = 2 + this.trie.getUint8(offset)*2;
|
||||||
|
let childCount = this.trie.getUint8(offset + 1);
|
||||||
|
|
||||||
|
/* Go through all children and find the next offset */
|
||||||
|
let childOffset = offset + relChildOffset;
|
||||||
|
let found = false;
|
||||||
|
for(let j = 0; j != childCount; ++j) {
|
||||||
|
if(String.fromCharCode(this.trie.getUint8(childOffset + j*4 + 3)) != searchString[foundPrefix])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
this.searchStack.push(this.trie.getUint32(childOffset + j*4, true) & 0x007fffff);
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Character not found, exit */
|
||||||
|
if(!found) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Save the whole found prefix for next time */
|
||||||
|
this.searchString = searchString.substr(0, foundPrefix);
|
||||||
|
|
||||||
|
/* If the whole thing was not found, return an empty result and offer
|
||||||
|
external search */
|
||||||
|
if(foundPrefix != searchString.length) {
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if(typeof document !== 'undefined') {
|
||||||
|
let link = document.getElementById('search-external');
|
||||||
|
if(link)
|
||||||
|
link.href = link.dataset.searchEngine.replace('{query}', encodeURIComponent(searchString));
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otherwise gather the results */
|
||||||
|
let results = [];
|
||||||
|
let leaves = [[this.searchStack[this.searchStack.length - 1], 0]];
|
||||||
|
while(leaves.length) {
|
||||||
|
/* Pop offset from the queue */
|
||||||
|
let current = leaves.shift();
|
||||||
|
let offset = current[0];
|
||||||
|
let suffixLength = current[1];
|
||||||
|
|
||||||
|
/* Populate the results with all values associated with this node */
|
||||||
|
let resultCount = this.trie.getUint8(offset);
|
||||||
|
for(let i = 0; i != resultCount; ++i) {
|
||||||
|
let index = this.trie.getUint16(offset + (i + 1)*2, true);
|
||||||
|
results.push(this.gatherResult(index, suffixLength, 0xffffff)); /* should be enough haha */
|
||||||
|
|
||||||
|
/* 'nuff said. */
|
||||||
|
if(results.length >= this.maxResults) return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dig deeper */
|
||||||
|
/* TODO: hmmm. this is helluvalot duplicated code. hmm. */
|
||||||
|
let relChildOffset = 2 + this.trie.getUint8(offset)*2;
|
||||||
|
let childCount = this.trie.getUint8(offset + 1);
|
||||||
|
let childOffset = offset + relChildOffset;
|
||||||
|
for(let j = 0; j != childCount; ++j) {
|
||||||
|
let offsetBarrier = this.trie.getUint32(childOffset + j*4, true);
|
||||||
|
|
||||||
|
/* Lookahead barrier, don't dig deeper */
|
||||||
|
if(offsetBarrier & 0x00800000) continue;
|
||||||
|
|
||||||
|
/* Append to the queue */
|
||||||
|
leaves.push([offsetBarrier & 0x007fffff, suffixLength + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
},
|
||||||
|
|
||||||
|
gatherResult: function(index, suffixLength, maxUrlPrefix) {
|
||||||
|
let flags = this.map.getUint8(index*4 + 3);
|
||||||
|
let resultOffset = this.map.getUint32(index*4, true) & 0x00ffffff;
|
||||||
|
|
||||||
|
/* The result is an alias, parse the aliased prefix */
|
||||||
|
let aliasedIndex = null;
|
||||||
|
if((flags & 0xf0) == 0x00) {
|
||||||
|
aliasedIndex = this.map.getUint16(resultOffset, true);
|
||||||
|
resultOffset += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The result has a prefix, parse that first, recursively */
|
||||||
|
let name = '';
|
||||||
|
let url = '';
|
||||||
|
if(flags & (1 << 3)) {
|
||||||
|
let prefixIndex = this.map.getUint16(resultOffset, true);
|
||||||
|
let prefixUrlPrefixLength = Math.min(this.map.getUint8(resultOffset + 2), maxUrlPrefix);
|
||||||
|
|
||||||
|
let prefix = this.gatherResult(prefixIndex, 0 /*ignored*/, prefixUrlPrefixLength);
|
||||||
|
name = prefix.name;
|
||||||
|
url = prefix.url;
|
||||||
|
|
||||||
|
resultOffset += 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The result has a suffix, extract its length */
|
||||||
|
let resultSuffixLength = 0;
|
||||||
|
if(flags & (1 << 0)) {
|
||||||
|
resultSuffixLength = this.map.getUint8(resultOffset);
|
||||||
|
++resultOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
let nextResultOffset = this.map.getUint32((index + 1)*4, true) & 0x00ffffff;
|
||||||
|
|
||||||
|
/* Extract name */
|
||||||
|
let j = resultOffset;
|
||||||
|
for(; j != nextResultOffset; ++j) {
|
||||||
|
let c = this.map.getUint8(j);
|
||||||
|
|
||||||
|
/* End of null-delimited name */
|
||||||
|
if(!c) {
|
||||||
|
++j;
|
||||||
|
break; /* null-delimited */
|
||||||
|
}
|
||||||
|
|
||||||
|
name += String.fromCharCode(c); /* eheh. IS THIS FAST?! */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The result is an alias and we're not deep inside resolving a prefix,
|
||||||
|
extract the aliased name and URL */
|
||||||
|
/* TODO: this abuses 0xffffff to guess how the call stack is deep and
|
||||||
|
that's just wrong, fix! */
|
||||||
|
if(aliasedIndex != null && maxUrlPrefix == 0xffffff) {
|
||||||
|
let alias = this.gatherResult(aliasedIndex, 0 /* ignored */, 0xffffff); /* should be enough haha */
|
||||||
|
url = alias.url;
|
||||||
|
flags = alias.flags;
|
||||||
|
|
||||||
|
/* Keeping in UTF-8, as we need that for proper slicing (and concatenating) */
|
||||||
|
return {name: name,
|
||||||
|
alias: alias.name,
|
||||||
|
url: alias.url,
|
||||||
|
flags: alias.flags,
|
||||||
|
suffixLength: suffixLength + resultSuffixLength};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otherwise extract URL from here */
|
||||||
|
let max = Math.min(j + maxUrlPrefix - url.length, nextResultOffset);
|
||||||
|
for(; j != max; ++j) {
|
||||||
|
url += String.fromCharCode(this.map.getUint8(j));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keeping in UTF-8, as we need that for proper slicing (and concatenating) */
|
||||||
|
return {name: name,
|
||||||
|
url: url,
|
||||||
|
flags: flags,
|
||||||
|
suffixLength: suffixLength + resultSuffixLength};
|
||||||
|
},
|
||||||
|
|
||||||
|
escape: function(name) {
|
||||||
|
return name.replace(/[\"&<>]/g, function (a) {
|
||||||
|
return { '"': '"', '&': '&', '<': '<', '>': '>' }[a];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
escapeForRtl: function(name) {
|
||||||
|
/* Besides the obvious escaping of HTML entities we also need
|
||||||
|
to escape punctuation, because due to the RTL hack to cut
|
||||||
|
text off on left side the punctuation characters get
|
||||||
|
reordered (of course). Prepending ‎ works for most
|
||||||
|
characters, parentheses we need to *soak* in it. But only
|
||||||
|
the right ones. And that for some reason needs to be also for &.
|
||||||
|
Huh. https://en.wikipedia.org/wiki/Right-to-left_mark */
|
||||||
|
return this.escape(name).replace(/[:=]/g, '‎$&').replace(/(\)|>|&|\/)/g, '‎$&‎');
|
||||||
|
},
|
||||||
|
|
||||||
|
renderResults: /* istanbul ignore next */ function(value, results) {
|
||||||
|
/* Normalize the value and encode as UTF-8 so the slicing works
|
||||||
|
properly */
|
||||||
|
value = this.toUtf8(value.trim());
|
||||||
|
|
||||||
|
if(!value.length) {
|
||||||
|
document.getElementById('search-help').style.display = 'block';
|
||||||
|
document.getElementById('search-results').style.display = 'none';
|
||||||
|
document.getElementById('search-notfound').style.display = 'none';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('search-help').style.display = 'none';
|
||||||
|
|
||||||
|
if(results.length) {
|
||||||
|
document.getElementById('search-results').style.display = 'block';
|
||||||
|
document.getElementById('search-notfound').style.display = 'none';
|
||||||
|
|
||||||
|
let list = '';
|
||||||
|
for(let i = 0; i != results.length; ++i) {
|
||||||
|
let type = '';
|
||||||
|
let color = '';
|
||||||
|
switch(results[i].flags >> 4) {
|
||||||
|
case 1:
|
||||||
|
type = 'namespace';
|
||||||
|
color = 'm-primary';
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
type = 'class';
|
||||||
|
color = 'm-primary';
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
type = 'struct';
|
||||||
|
color = 'm-primary';
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
type = 'union';
|
||||||
|
color = 'm-primary';
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
type = 'typedef';
|
||||||
|
color = 'm-primary';
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
type = 'func';
|
||||||
|
color = 'm-info';
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
type = 'var';
|
||||||
|
color = 'm-default';
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
type = 'enum';
|
||||||
|
color = 'm-primary';
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
type = 'enum val';
|
||||||
|
color = 'm-default';
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
type = 'define';
|
||||||
|
color = 'm-info';
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
type = 'group';
|
||||||
|
color = 'm-success';
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
type = 'page';
|
||||||
|
color = 'm-success';
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
type = 'dir';
|
||||||
|
color = 'm-warning';
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
type = 'file';
|
||||||
|
color = 'm-warning';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Labels + */
|
||||||
|
list += '<li' + (i ? '' : ' id="search-current"') + '><a href="' + results[i].url + '" onmouseover="selectResult(event)"><div class="m-label m-flat ' + color + '">' + type + '</div>' + (results[i].flags & 2 ? '<div class="m-label m-danger">deprecated</div>' : '') + (results[i].flags & 4 ? '<div class="m-label m-danger">deleted</div>' : '');
|
||||||
|
|
||||||
|
/* Render the alias (cut off from the right) */
|
||||||
|
if(results[i].alias) {
|
||||||
|
list += '<div class="m-dox-search-alias"><span class="m-text m-dim">' + this.escape(results[i].name.substr(0, results[i].name.length - value.length - results[i].suffixLength)) + '</span><span class="m-dox-search-typed">' + this.escape(results[i].name.substr(results[i].name.length - value.length - results[i].suffixLength, value.length)) + '</span>' + this.escapeForRtl(results[i].name.substr(results[i].name.length - results[i].suffixLength)) + '<span class="m-text m-dim">: ' + this.escape(results[i].alias) + '</span>';
|
||||||
|
|
||||||
|
/* Render the normal thing (cut off from the left, have to
|
||||||
|
escape for RTL) */
|
||||||
|
} else {
|
||||||
|
list += '<div><span class="m-text m-dim">' + this.escapeForRtl(results[i].name.substr(0, results[i].name.length - value.length - results[i].suffixLength)) + '</span><span class="m-dox-search-typed">' + this.escapeForRtl(results[i].name.substr(results[i].name.length - value.length - results[i].suffixLength, value.length)) + '</span>' + this.escapeForRtl(results[i].name.substr(results[i].name.length - results[i].suffixLength));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The closing */
|
||||||
|
list += '</div></a></li>';
|
||||||
|
}
|
||||||
|
document.getElementById('search-results').innerHTML = this.fromUtf8(list);
|
||||||
|
document.getElementById('search-current').scrollIntoView(true);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
document.getElementById('search-results').style.display = 'none';
|
||||||
|
document.getElementById('search-notfound').style.display = 'block';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/* istanbul ignore next */
|
||||||
|
function selectResult(event) {
|
||||||
|
if(event.currentTarget.parentNode.id == 'search-current') return;
|
||||||
|
|
||||||
|
let current = document.getElementById('search-current');
|
||||||
|
current.id = '';
|
||||||
|
event.currentTarget.parentNode.id = 'search-current';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* istanbul ignore next */
|
||||||
|
function showSearch() {
|
||||||
|
window.location.hash = '#search';
|
||||||
|
|
||||||
|
/* Prevent accidental scrolling of the body, prevent page layout jumps */
|
||||||
|
let scrolledBodyWidth = document.body.offsetWidth;
|
||||||
|
document.body.style.overflow = 'hidden';
|
||||||
|
document.body.style.paddingRight = (document.body.offsetWidth - scrolledBodyWidth) + 'px';
|
||||||
|
|
||||||
|
document.getElementById('search-input').value = '';
|
||||||
|
document.getElementById('search-input').focus();
|
||||||
|
document.getElementById('search-results').style.display = 'none';
|
||||||
|
document.getElementById('search-notfound').style.display = 'none';
|
||||||
|
document.getElementById('search-help').style.display = 'block';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* istanbul ignore next */
|
||||||
|
function hideSearch() {
|
||||||
|
/* Go back to the previous state (that removes the #search hash) */
|
||||||
|
window.history.back();
|
||||||
|
|
||||||
|
/* Restore scrollbar, prevent page layout jumps */
|
||||||
|
document.body.style.overflow = 'auto';
|
||||||
|
document.body.style.paddingRight = '0';
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Only in case we're running in a browser. Why a simple if(document) doesn't
|
||||||
|
work is beyond me. */ /* istanbul ignore if */
|
||||||
|
if(typeof document !== 'undefined') {
|
||||||
|
document.getElementById('search-input').oninput = function(event) {
|
||||||
|
let value = document.getElementById('search-input').value;
|
||||||
|
let prev = performance.now();
|
||||||
|
let results = Search.search(value);
|
||||||
|
let after = performance.now();
|
||||||
|
Search.renderResults(value, results);
|
||||||
|
if(value.trim().length) {
|
||||||
|
document.getElementById('search-symbolcount').innerHTML =
|
||||||
|
results.length + (results.length >= Search.maxResults ? '+' : '') + " results (" + Math.round((after - prev)*10)/10 + " ms)";
|
||||||
|
} else
|
||||||
|
document.getElementById('search-symbolcount').innerHTML =
|
||||||
|
Search.symbolCount + " symbols (" + Math.round(Search.dataSize/102.4)/10 + " kB)";
|
||||||
|
};
|
||||||
|
|
||||||
|
document.onkeydown = function(event) {
|
||||||
|
/* Search shown */
|
||||||
|
if(window.location.hash == '#search') {
|
||||||
|
/* Close the search */
|
||||||
|
if(event.key == 'Escape') {
|
||||||
|
hideSearch();
|
||||||
|
|
||||||
|
/* Select next item */
|
||||||
|
} else if(event.key == 'ArrowDown' || (event.key == 'Tab' && !event.shiftKey)) {
|
||||||
|
let current = document.getElementById('search-current');
|
||||||
|
if(current) {
|
||||||
|
let next = current.nextSibling;
|
||||||
|
if(next) {
|
||||||
|
current.id = '';
|
||||||
|
next.id = 'search-current';
|
||||||
|
next.scrollIntoView(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false; /* so the keypress doesn't affect input cursor */
|
||||||
|
|
||||||
|
/* Select prev item */
|
||||||
|
} else if(event.key == 'ArrowUp' || (event.key == 'Tab' && event.shiftKey)) {
|
||||||
|
let current = document.getElementById('search-current');
|
||||||
|
if(current) {
|
||||||
|
let prev = current.previousSibling;
|
||||||
|
if(prev) {
|
||||||
|
current.id = '';
|
||||||
|
prev.id = 'search-current';
|
||||||
|
prev.scrollIntoView(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false; /* so the keypress doesn't affect input cursor */
|
||||||
|
|
||||||
|
/* Go to result */
|
||||||
|
} else if(event.key == 'Enter') {
|
||||||
|
document.getElementById('search-current').firstElementChild.click();
|
||||||
|
|
||||||
|
/* We might be staying on the same page, so restore scrollbar,
|
||||||
|
and prevent page layout jumps */
|
||||||
|
document.body.style.overflow = 'auto';
|
||||||
|
document.body.style.paddingRight = '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Search hidden */
|
||||||
|
} else {
|
||||||
|
/* Open the search on the T or Tab key */
|
||||||
|
if((event.key.toLowerCase() == 't' || event.key == 'Tab') && !event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey) {
|
||||||
|
showSearch();
|
||||||
|
return false; /* so T doesn't get entered into the box */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For Node.js testing */ /* istanbul ignore else */
|
||||||
|
if(typeof module !== 'undefined') { module.exports = { Search: Search }; }
|
||||||
2
searchdata.js
Normal file
2
searchdata.js
Normal file
File diff suppressed because one or more lines are too long
78
terminal.css
Normal file
78
terminal.css
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
.terminal {
|
||||||
|
box-shadow: rgba(0, 0, 0, 0.8) 0px 20px 70px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
max-width: 550px;
|
||||||
|
height: 210px;
|
||||||
|
margin: 0 auto;
|
||||||
|
background-color: #272a3aa6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.terminal > .fakeMenu {
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 25px;
|
||||||
|
background-color: #1b1e2d;
|
||||||
|
margin: 0 auto;
|
||||||
|
border-top-right-radius: 5px;
|
||||||
|
border-top-left-radius: 5px;
|
||||||
|
font-family: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
.terminal > .fakeMenu > .fakeButtons {
|
||||||
|
height: 10px;
|
||||||
|
width: 10px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 1px solid #000;
|
||||||
|
position: relative;
|
||||||
|
top: 6px;
|
||||||
|
left: 6px;
|
||||||
|
background-color: #ff3b47;
|
||||||
|
border-color: #9d252b;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.terminal > .fakeMenu > .fakeMinimize {
|
||||||
|
left: 11px;
|
||||||
|
background-color: #ffc100;
|
||||||
|
border-color: #9d802c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.terminal > .fakeMenu > .fakeZoom {
|
||||||
|
left: 16px;
|
||||||
|
background-color: #00d742;
|
||||||
|
border-color: #049931;
|
||||||
|
}
|
||||||
|
|
||||||
|
.terminal > .fakeScreen {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 10px;
|
||||||
|
border-bottom-left-radius: 5px;
|
||||||
|
border-bottom-right-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.terminal > .fakeScreen > pre {
|
||||||
|
background-color: initial;
|
||||||
|
margin: initial;
|
||||||
|
padding: initial;
|
||||||
|
overflow-x: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
.terminal > .fakeScreen > pre > code {
|
||||||
|
background: initial;
|
||||||
|
background-color: initial;
|
||||||
|
overflow: hidden;
|
||||||
|
margin: initial;
|
||||||
|
padding: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
.terminal > .fakeScreen > p {
|
||||||
|
color: #9CD9F0;
|
||||||
|
position: relative;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -8.5em;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 1.25em;
|
||||||
|
font-family: monospace;
|
||||||
|
white-space: normal;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
44
terminal.js
Normal file
44
terminal.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
(function() {
|
||||||
|
var backend = '// Continuable for backend developers:\n(http_request("github.com/Naios") && http_request("atom.io"))\n .then([] (std::string github, std::string atom) {\n // ...\n return mysql_query("SELECT * FROM `users`");\n })\n .then([] (ResultSet result) {\n // ...\n }, executor->post());';
|
||||||
|
var game = '// Continuable for game developers:\nme->WaitForPlayer()\n .then([&] (Player* player) {\n return me->MoveTo(player->GetPosition());\n })\n .then(me->Say("Hello friend!"))\n .then(me->Wait(3s)))\n .then(me->MoveTo(me->GetHomePosition()));';
|
||||||
|
var adventurous = '// Continuable for the adventurous:\ntry {\n auto response = co_await http_request("github.com/Naios");\n} catch (std::exception const& e) {\n // ...\n}\nauto c = cti::make_ready_continuable(0, 1);\nauto [ first, second ] = co_await std::move(c);\nco_return first + second;';
|
||||||
|
var coroutines = '// Continuable for mastering coroutines:\ncti::when_all(\n []() -> cti::continuable<int, int> {\n co_return std::make_tuple(0, 1); // ...\n }(), []() -> cti::continuable<int, int> {\n co_return std::make_tuple(2, 3); // ...\n }()).then([](int, int, int, int) {\n // ...\n });';
|
||||||
|
|
||||||
|
// Teach hljs some new keywords...
|
||||||
|
var cpp = hljs.getLanguage('cpp').exports.k;
|
||||||
|
cpp.built_in +=
|
||||||
|
" http_request mysql_query then exception post make_continuable cti make_ready_continuable ResultSet move WaitForPlayer MoveTo Player GetPosition GetHomePosition Wait Say when_all continuable make_tuple";
|
||||||
|
cpp.keyword +=
|
||||||
|
" co_await co_return";
|
||||||
|
cpp.literal +=
|
||||||
|
" 3s";
|
||||||
|
|
||||||
|
hljs.configure({
|
||||||
|
tabReplace: ' ',
|
||||||
|
// classPrefix: '',
|
||||||
|
languages: ['cpp'],
|
||||||
|
});
|
||||||
|
|
||||||
|
function highlight(code) {
|
||||||
|
return hljs.highlight('cpp', code, "", null).value;
|
||||||
|
};
|
||||||
|
|
||||||
|
var typed = new Typed('#typedterminal', {
|
||||||
|
strings: [
|
||||||
|
highlight(backend),
|
||||||
|
highlight(game),
|
||||||
|
highlight(adventurous),
|
||||||
|
highlight(coroutines),
|
||||||
|
],
|
||||||
|
typeSpeed: 6,
|
||||||
|
backSpeed: 4,
|
||||||
|
startDelay: 1100,
|
||||||
|
loop: true,
|
||||||
|
shuffle: true,
|
||||||
|
backDelay: 5500,
|
||||||
|
// smartBackspace: true,
|
||||||
|
// fadeOut: true,
|
||||||
|
// fadeOutClass: 'typed-fade-out',
|
||||||
|
// fadeOutDelay: 5500,
|
||||||
|
});
|
||||||
|
})();
|
||||||
202
tutorial-awaiting-continuables.html
Normal file
202
tutorial-awaiting-continuables.html
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
<!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>Tutorial » Awaiting continuables | 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" id="m-navbar-current">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">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>
|
||||||
|
<span class="m-breadcrumb"><a href="tutorial.html">Tutorial</a> »</span>
|
||||||
|
|
||||||
|
Awaiting continuables
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p>Explains how to use the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> together with <code>co_await</code>.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#tutorial-awaiting-continuables-usage">Using co_await on continuables</a></li>
|
||||||
|
<li><a href="#tutorial-awaiting-continuables-await">Using co_await with exceptions</a></li>
|
||||||
|
<li><a href="#tutorial-awaiting-continuables-noexcept">Using co_await with disabled exceptions</a></li>
|
||||||
|
<li><a href="#tutorial-awaiting-continuables-return">Using continuables as return type from coroutines</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<section id="tutorial-awaiting-continuables-usage"><h2><a href="#tutorial-awaiting-continuables-usage">Using co_await on continuables</a></h2><p>Coroutines (<code>co_await</code>) are supported by continuables when the underlying toolchain supports the TS. Currently this works in MSVC 2017 and Clang 5.0.</p><aside class="m-note m-warning"><h4>Attention</h4><p>You have to enable this feature through defining the <code>CONTINUABLE_WITH_EXPERIMENTAL_COROUTINE</code> preprocessor definition.</p></aside><p>It is possible to await for any <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> as shown below:</p><pre class="m-code"><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="n">co_await</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o"><</span><span class="kt">int</span><span class="o">></span><span class="p">([](</span><span class="k">auto</span><span class="o">&&</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">0</span><span class="p">);</span>
|
||||||
|
<span class="p">});</span></pre><p>As described in <a href="classcti_1_1continuable__base.html#ac79b103d5c000a3a3d1b98d8adcf58e8" class="m-dox">continuable_base::<wbr />operator co_await()</a> a continuable with multiple arguments as result will wrap its result into a <code>std::tuple</code>:</p><pre class="m-code"><span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="o">></span> <span class="n">i</span> <span class="o">=</span> <span class="n">co_await</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span></pre></section><section id="tutorial-awaiting-continuables-await"><h2><a href="#tutorial-awaiting-continuables-await">Using co_await with exceptions</a></h2><p>When a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> was resolved through an exception the exception is rethrown from the <code>co_await</code> expression:</p><pre class="m-code"><span class="k">try</span> <span class="p">{</span>
|
||||||
|
<span class="k">auto</span> <span class="n">response</span> <span class="o">=</span> <span class="n">co_await</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">exception</span> <span class="k">const</span><span class="o">&</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Handle the exception</span>
|
||||||
|
<span class="p">}</span></pre></section><section id="tutorial-awaiting-continuables-noexcept"><h2><a href="#tutorial-awaiting-continuables-noexcept">Using co_await with disabled exceptions</a></h2><p>In case the library is configured to use error codes or a custom error type the return type of the co_await expression is changed.</p><p>The result is returned through an internal proxy object which may be queried for the error object:</p><table class="m-table"><thead><tr><th>Continuation type</th><th>co_await returns</th></tr></thead><tbody><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <></code></td><td><code>unspecified<void></code></td></tr><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <Arg></code></td><td><code>unspecified<Arg></code></td></tr><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <Args...></code></td><td><code>unspecified<std::tuple<Args...>></code></td></tr></tbody></table><p>The interface of the proxy object is similar to the one proposed in the <code>std::expected</code> proposal:</p><pre class="m-code"><span class="k">if</span> <span class="p">(</span><span class="k">auto</span><span class="o">&&</span> <span class="n">result</span> <span class="o">=</span> <span class="n">co_await</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">))</span> <span class="p">{</span>
|
||||||
|
<span class="k">auto</span> <span class="n">value</span> <span class="o">=</span> <span class="o">*</span><span class="n">result</span><span class="p">;</span>
|
||||||
|
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">error_type</span> <span class="n">error</span> <span class="o">=</span> <span class="n">result</span><span class="p">.</span><span class="n">get_exception</span><span class="p">();</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">co_await</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="kt">bool</span><span class="p">(</span><span class="n">result</span><span class="p">);</span>
|
||||||
|
<span class="n">result</span><span class="p">.</span><span class="n">is_value</span><span class="p">();</span>
|
||||||
|
<span class="n">result</span><span class="p">.</span><span class="n">is_exception</span><span class="p">();</span>
|
||||||
|
<span class="o">*</span><span class="n">result</span><span class="p">;</span> <span class="c1">// Same as result.get_value()</span>
|
||||||
|
<span class="n">result</span><span class="p">.</span><span class="n">get_value</span><span class="p">();</span>
|
||||||
|
<span class="n">result</span><span class="p">.</span><span class="n">get_exception</span><span class="p">();</span></pre></section><section id="tutorial-awaiting-continuables-return"><h2><a href="#tutorial-awaiting-continuables-return">Using continuables as return type from coroutines</a></h2><p>It is possible to use a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> as return type from coroutines.</p><pre class="m-code"><span class="n">cti</span><span class="o">::</span><span class="n">continuable</span><span class="o"><></span> <span class="n">resolve_async_void</span><span class="p">()</span> <span class="p">{</span>
|
||||||
|
<span class="n">co_await</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">);</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="n">co_return</span><span class="p">;</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">continuable</span><span class="o"><</span><span class="kt">int</span><span class="o">></span> <span class="n">resolve_async</span><span class="p">()</span> <span class="p">{</span>
|
||||||
|
<span class="n">co_await</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">);</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="n">co_return</span> <span class="mi">0</span><span class="p">;</span>
|
||||||
|
<span class="p">}</span></pre><p>Additionally it's possible to return multiple return values from coroutines by wrapping those in a tuple like type:</p><pre class="m-code"><span class="n">cti</span><span class="o">::</span><span class="n">continuable</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="o">></span> <span class="n">resolve_async_multiple</span><span class="p">()</span> <span class="p">{</span>
|
||||||
|
<span class="n">co_await</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">);</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="n">co_return</span> <span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span></pre></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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
259
tutorial-chaining-continuables.html
Normal file
259
tutorial-chaining-continuables.html
Normal file
@ -0,0 +1,259 @@
|
|||||||
|
<!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>Tutorial » Chaining continuables | 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" id="m-navbar-current">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">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>
|
||||||
|
<span class="m-breadcrumb"><a href="tutorial.html">Tutorial</a> »</span>
|
||||||
|
|
||||||
|
Chaining continuables
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p>Explains how to chain multiple <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects together.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="#tutorial-chaining-continuables-then">Using then and results</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#tutorial-chaining-continuables-then-partial">Making use of partial argument application</a></li>
|
||||||
|
<li><a href="#tutorial-chaining-continuables-then-executors">Assigning a specific executor to then</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href="#tutorial-chaining-continuables-fail">Using fail and exceptions</a></li>
|
||||||
|
<li><a href="#tutorial-chaining-continuables-next">Using next to handle all paths</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<section id="tutorial-chaining-continuables-then"><h2><a href="#tutorial-chaining-continuables-then">Using then and results</a></h2><p>A <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> provides various methods to continue the asynchronous call hierarchy. The most important method therefor is <a href="classcti_1_1continuable__base.html#adf02030d7211ffc4610f3bcb13d2a149" class="m-dox">continuable_base::<wbr />then</a> which changes the object through attaching a result handler:</p><pre class="m-code"><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</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">// Do something...</span>
|
||||||
|
<span class="p">});</span></pre><p>A new <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> is created which result depends on the return type of the handler. For instance it is possible to return plain values or the next <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> to continue the call hierarchy. See <a href="classcti_1_1continuable__base.html#adf02030d7211ffc4610f3bcb13d2a149" class="m-dox">continuable_base::<wbr />then</a> for details.</p><pre class="m-code"><span class="n">mysql_query</span><span class="p">(</span><span class="s">"SELECT `id`, `name` FROM `users`"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">ResultSet</span> <span class="n">users</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Return the next continuable to process ...</span>
|
||||||
|
<span class="k">return</span> <span class="n">mysql_query</span><span class="p">(</span><span class="s">"SELECT `id` name FROM `sessions`"</span><span class="p">);</span>
|
||||||
|
<span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">ResultSet</span> <span class="n">sessions</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ... or pass multiple values to the next callback using tuples or pairs ...</span>
|
||||||
|
<span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">sessions</span><span class="p">),</span> <span class="nb">true</span><span class="p">);</span>
|
||||||
|
<span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">ResultSet</span> <span class="n">sessions</span><span class="p">,</span> <span class="kt">bool</span> <span class="n">is_ok</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ... or pass a single value to the next callback ...</span>
|
||||||
|
<span class="k">return</span> <span class="mi">10</span><span class="p">;</span>
|
||||||
|
<span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="k">auto</span> <span class="n">value</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ^^^^ Templated callbacks are possible too</span>
|
||||||
|
<span class="p">})</span>
|
||||||
|
<span class="c1">// ... you may even pass continuables to the `then` method directly:</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">(</span><span class="n">mysql_query</span><span class="p">(</span><span class="s">"SELECT * FROM `statistics`"</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">ResultSet</span> <span class="n">result</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre><section id="tutorial-chaining-continuables-then-partial"><h3><a href="#tutorial-chaining-continuables-then-partial">Making use of partial argument application</a></h3><p>Callbacks passed to <a href="classcti_1_1continuable__base.html#adf02030d7211ffc4610f3bcb13d2a149" class="m-dox">then</a> are only called with the amount of arguments that are accepted.</p><pre class="m-code"><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">&&</span> <span class="n">read_file</span><span class="p">(</span><span class="s">"entries.csv"</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([]</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ^^^^^^ The original signature was <std::string, Buffer>,</span>
|
||||||
|
<span class="c1">// however, the callback is only invoked with the amount of</span>
|
||||||
|
<span class="c1">// arguments it's accepting.</span>
|
||||||
|
<span class="p">});</span></pre><p>This makes it possible to attach a callback accepting nothing to every <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</p></section><section id="tutorial-chaining-continuables-then-executors"><h3><a href="#tutorial-chaining-continuables-then-executors">Assigning a specific executor to then</a></h3><p>Dispatching a callback through a specific executor is a common usage scenario and supported through the second argument of <a href="classcti_1_1continuable__base.html#adf02030d7211ffc4610f3bcb13d2a149" class="m-dox">then</a>:</p><pre class="m-code"><span class="k">auto</span> <span class="n">executor</span> <span class="o">=</span> <span class="p">[](</span><span class="k">auto</span><span class="o">&&</span> <span class="n">work</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Dispatch the work here, store it for later</span>
|
||||||
|
<span class="c1">// invocation or move it to another thread.</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">forward</span><span class="o"><</span><span class="k">decltype</span><span class="p">(</span><span class="n">work</span><span class="p">)</span><span class="o">></span><span class="p">(</span><span class="n">work</span><span class="p">)();</span>
|
||||||
|
<span class="p">};</span>
|
||||||
|
|
||||||
|
<span class="n">read_file</span><span class="p">(</span><span class="s">"entries.csv"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">Buffer</span> <span class="n">buffer</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">},</span> <span class="n">executor</span><span class="p">);</span>
|
||||||
|
<span class="c1">// ^^^^^^^^</span></pre><p>The supplied <code>work</code> callable may be stored and moved for later usage on a possible different thread or execution context.</p><aside class="m-note m-info"><h4>Note</h4><p>If you are intending to change the context the asynchronous task is running, you need to specify this inside the function that supplies the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> through moving the <a href="classcti_1_1promise__base.html" class="m-dox">promise_<wbr />base</a>.</p><pre class="m-code"><span class="k">auto</span> <span class="nf">http_request</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">url</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">return</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></span><span class="p">(</span>
|
||||||
|
<span class="p">[</span><span class="n">url</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">url</span><span class="p">)](</span><span class="k">auto</span><span class="o">&&</span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">async</span><span class="p">([</span><span class="n">promise</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">forward</span><span class="o"><</span><span class="k">decltype</span><span class="p">(</span><span class="n">promise</span><span class="p">)</span><span class="o">></span><span class="p">(</span><span class="n">promise</span><span class="p">)]</span>
|
||||||
|
<span class="p">()</span> <span class="k">mutable</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">"<html> ... </html>"</span><span class="p">);</span>
|
||||||
|
<span class="p">});</span>
|
||||||
|
<span class="p">});</span>
|
||||||
|
<span class="p">}</span></pre></aside></section></section><section id="tutorial-chaining-continuables-fail"><h2><a href="#tutorial-chaining-continuables-fail">Using fail and exceptions</a></h2><p>Asynchronous exceptions are supported too. Exceptions that were set through <a href="classcti_1_1promise__base.html#a609a8cd2ccd43010b154ee0be6165be1" class="m-dox">promise_base::<wbr />set_exception</a> are forwarded to the first available registered handler that was attached through <a href="classcti_1_1continuable__base.html#a7001122101ed32f729e39c53d6cb9c7f" class="m-dox">continuable_base::<wbr />fail</a> :</p><pre class="m-code"><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</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">// Is never called if an error occurs</span>
|
||||||
|
<span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">fail</span><span class="p">([]</span> <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">exception_ptr</span> <span class="n">ptr</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">try</span> <span class="p">{</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">rethrow_exception</span><span class="p">(</span><span class="n">ptr</span><span class="p">);</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">exception</span> <span class="k">const</span><span class="o">&</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Handle the exception or error code here</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="p">});</span></pre><p>Multiple handlers are allowed to be registered, however the asynchronous call hierarchy is aborted after the first called fail handler and only the closest handler below is called.</p><aside class="m-note m-info"><h4>Note</h4><p>Retrieving a <code>std::exception_ptr</code> from a current exception may be done as shown below:</p><pre class="m-code"><span class="k">auto</span> <span class="nf">do_sth</span><span class="p">()</span> <span class="p">{</span>
|
||||||
|
<span class="k">return</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o"><</span><span class="kt">void</span><span class="o">></span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">(</span><span class="k">auto</span><span class="o">&&</span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">try</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Usually the exception is thrown by another expression</span>
|
||||||
|
<span class="k">throw</span> <span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="p">{};</span>
|
||||||
|
<span class="p">}</span> <span class="k">catch</span><span class="p">(...)</span> <span class="p">{</span>
|
||||||
|
<span class="n">promise</span><span class="p">.</span><span class="n">set_exception</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">current_exception</span><span class="p">());</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
<span class="p">});</span>
|
||||||
|
<span class="p">}</span></pre></aside><p>Continuable also supports error codes automatically if exceptions are disabled. Additionally it is possible to specify a custom error type through defining.</p><pre class="m-code"><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</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">// Is never called if an error occurs</span>
|
||||||
|
<span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">fail</span><span class="p">([]</span> <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">error_condition</span> <span class="n">error</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="n">error</span><span class="p">.</span><span class="n">value</span><span class="p">();</span>
|
||||||
|
<span class="n">error</span><span class="p">.</span><span class="n">category</span><span class="p">();</span>
|
||||||
|
<span class="p">});</span></pre><p>The <a href="group___base.html#ga7fcba5095c36f2577e1f4a2c5608dc6a" class="m-dox">error_<wbr />type</a> will be <code>std::exception_ptr</code> except if any of the following definitions is defined:</p><ul><li><code>CONTINUABLE_WITH_NO_EXCEPTIONS</code>: Define this to use <code>std::error_condition</code> as <a href="group___base.html#ga7fcba5095c36f2577e1f4a2c5608dc6a" class="m-dox">error_<wbr />type</a> and to disable exception support. When exceptions are disabled this definition is set automatically.</li><li><code>CONTINUABLE_WITH_CUSTOM_ERROR_TYPE</code>: Define this to use a user defined error type.</li></ul><aside class="m-note m-warning"><h4>Attention</h4><p>By default unhandled exceptions or errors will trigger a built-in trap that causes abnormal application shutdown. In order to prevent this and to allow unhandled errors define <code>CONTINUABLE_WITH_UNHANDLED_EXCEPTIONS</code>.</p></aside></section><section id="tutorial-chaining-continuables-next"><h2><a href="#tutorial-chaining-continuables-next">Using next to handle all paths</a></h2><p>Sometimes it's required to provide a continuation and error handler from the same object. In order to avoid overloading conflicts there is the special method <a href="classcti_1_1continuable__base.html#ad4960d0794abb800f1dfd9a668900149" class="m-dox">continuable_base::<wbr />next</a> provided. The exception path overload is marked through the <a href="group___base.html#ga9518a71f87f4d0efd18518c818907a92" class="m-dox">dispatch_<wbr />error_<wbr />tag</a> :</p><pre class="m-code"><span class="k">struct</span> <span class="n">handle_all_paths</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">// ...</span>
|
||||||
|
|
||||||
|
<span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">next</span><span class="p">(</span><span class="n">handle_all_paths</span><span class="p">{});</span></pre></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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
239
tutorial-connecting-continuables.html
Normal file
239
tutorial-connecting-continuables.html
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
<!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>Tutorial » Connecting continuables | 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" id="m-navbar-current">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">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>
|
||||||
|
<span class="m-breadcrumb"><a href="tutorial.html">Tutorial</a> »</span>
|
||||||
|
|
||||||
|
Connecting continuables
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p>Explains how to connect various <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects together.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#tutorial-connecting-continuables-strategies">Connections and strategies</a></li>
|
||||||
|
<li>
|
||||||
|
<a href="#tutorial-connecting-continuables-aggregated">Using aggregated strategies</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#tutorial-connecting-continuables-aggregated-all">Using the all connection</a></li>
|
||||||
|
<li><a href="#tutorial-connecting-continuables-aggregated-seq">Using the sequential connection</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href="#tutorial-connecting-continuables-any">Using the any connection</a></li>
|
||||||
|
<li><a href="#tutorial-connecting-continuables-mixed">Mixing different strategies</a></li>
|
||||||
|
<li><a href="#tutorial-connecting-continuables-nested">Nested continuables and plain types</a></li>
|
||||||
|
<li><a href="#tutorial-connecting-continuables-populate">Populating a container from arbitrary continuables</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<section id="tutorial-connecting-continuables-strategies"><h2><a href="#tutorial-connecting-continuables-strategies">Connections and strategies</a></h2><p>Connections make it possible to describe the dependencies between an arbitrary count of <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects in order resolve a returned <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> as soon as the dependencies are fulfilled.</p><p>For each connection strategy <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> provides an operator for for instance <a href="classcti_1_1continuable__base.html#a43ad4bfb19234a7856972d97337498db" class="m-dox">continuable_base::<wbr />operator &&</a> and a free function, <a href="group___connections.html#gaef652b8561f76cad49e83cfa21a71734" class="m-dox">when_<wbr />all</a> for example. Both work similar however the free functions are capable of working with nested sequences as described in <a href="tutorial-connecting-continuables.html#tutorial-connecting-continuables-nested" class="m-dox">Nested continuables and plain types</a>.</p><aside class="m-note m-info"><h4>Note</h4><p>Connections between <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects are ensured to be <strong>thread-safe</strong> and <strong>wait-free</strong> by library design (when assuming that <code>std::call_once</code> is wait-free - which depends on the toolchain).</p></aside></section><section id="tutorial-connecting-continuables-aggregated"><h2><a href="#tutorial-connecting-continuables-aggregated">Using aggregated strategies</a></h2><p>Aggregated strategies will call the result handler with the compound result of all connected <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects.</p><p>The compound result is deduced as following. Every <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> maps its result to the result itself as shown below. When multiple <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects are connected on the same depth, the result is joined. See <a href="tutorial-connecting-continuables.html#tutorial-connecting-continuables-nested" class="m-dox">Nested continuables and plain types</a> for details.</p><table class="m-table"><thead><tr><th>Continuation type</th><th>In tuple like</th><th>In container (<code>std::vector</code>)</th></tr></thead><tbody><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <></code></td><td><code><none></code></td><td><code><none></code></td></tr><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <Arg></code></td><td><code>Arg</code></td><td><code>Arg</code></td></tr><tr><td><code><a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with <Args...></code></td><td><code>Args...</code></td><td><code>std::tuple<Args...></code></td></tr></tbody></table><section id="tutorial-connecting-continuables-aggregated-all"><h3><a href="#tutorial-connecting-continuables-aggregated-all">Using the all connection</a></h3><p>The <em>all</em> strategy invokes all connected continuable at once, it tries to resolve the connected <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects as fast as possible. It is possible to connect multiple <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects together through the <em>all</em> strategy by using <a href="classcti_1_1continuable__base.html#a43ad4bfb19234a7856972d97337498db" class="m-dox">continuable_base::<wbr />operator &&</a> or <a href="group___connections.html#gaef652b8561f76cad49e83cfa21a71734" class="m-dox">when_<wbr />all</a>. In contrast to the operator the free functions are capable of workin with plain types and deeply nested <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects as described in <a href="tutorial-connecting-continuables.html#tutorial-connecting-continuables-nested" class="m-dox">Nested continuables and plain types</a> .</p><pre class="m-code"><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">&&</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"travis-ci.org"</span><span class="p">)</span> <span class="o">&&</span>
|
||||||
|
<span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">travis</span><span class="p">,</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">atom</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// The callback is called with the</span>
|
||||||
|
<span class="c1">// response of github, travis and atom.</span>
|
||||||
|
<span class="p">});</span></pre></section><section id="tutorial-connecting-continuables-aggregated-seq"><h3><a href="#tutorial-connecting-continuables-aggregated-seq">Using the sequential connection</a></h3><p>The <em>sequential</em> strategy invokes all connected continuable one after each other, it tries to resolve the next connected <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects as soon as the previous one was resolved. It is possible to connect multiple <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects together through the <em>sequential</em> strategy by using <a href="classcti_1_1continuable__base.html#abaaaf8a35827456fead299851268760e" class="m-dox">continuable_base::<wbr />operator>></a> or <a href="group___connections.html#ga481c31024079b6074617c64b16e615dd" class="m-dox">when_<wbr />seq</a>.</p><pre class="m-code"><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">>></span> <span class="n">http_request</span><span class="p">(</span><span class="s">"travis-ci.org"</span><span class="p">)</span> <span class="o">>></span>
|
||||||
|
<span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">travis</span><span class="p">,</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">atom</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// The requests are invoked sequentially instead</span>
|
||||||
|
<span class="c1">// of requesting all at once.</span>
|
||||||
|
<span class="p">});</span></pre></section></section><section id="tutorial-connecting-continuables-any"><h2><a href="#tutorial-connecting-continuables-any">Using the any connection</a></h2><p>The any connection strategy is completely different from the two introduces before: It calls the result handler with the first result or exception available. All <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects are required to have the same types of arguments.</p><pre class="m-code"><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">||</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"travis-ci.org"</span><span class="p">)</span> <span class="o">||</span>
|
||||||
|
<span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github_or_travis_or_atom</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// The callback is called with the first response</span>
|
||||||
|
<span class="c1">// of either github, travis or atom.</span>
|
||||||
|
<span class="p">});</span></pre></section><section id="tutorial-connecting-continuables-mixed"><h2><a href="#tutorial-connecting-continuables-mixed">Mixing different strategies</a></h2><p>Mixing different strategies through operators and free functions is natively supported as shown below:</p><pre class="m-code"><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span> <span class="o">&&</span>
|
||||||
|
<span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"travis-ci.org"</span><span class="p">)</span> <span class="o">||</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">)))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">github</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">travis_or_atom</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// The callback is called with the response of</span>
|
||||||
|
<span class="c1">// github for sure and the second parameter represents</span>
|
||||||
|
<span class="c1">// the response of travis or atom.</span>
|
||||||
|
<span class="p">});</span></pre></section><section id="tutorial-connecting-continuables-nested"><h2><a href="#tutorial-connecting-continuables-nested">Nested continuables and plain types</a></h2><p>For every operator that was shown above, there exists a free function that provides at least the same functionality:</p><pre class="m-code"><span class="n">cti</span><span class="o">::</span><span class="n">when_all</span><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">),</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"travis-ci.org"</span><span class="p">));</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">when_any</span><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">),</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"travis-ci.org"</span><span class="p">));</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">when_seq</span><span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">),</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"travis-ci.org"</span><span class="p">));</span></pre><p>Additionally the free functions are capable of working with continuables deeply nested inside tuple like objects (<code>std::tuple</code>, <code>std::pair</code> and <code>std::array</code>) as well as homogeneous containers (<code>std::vector</code>, <code>std::list</code> etc.).</p><pre class="m-code"><span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o"><</span><span class="n">cti</span><span class="o">::</span><span class="n">continuable</span><span class="o"><</span><span class="kt">int</span><span class="o">>>></span> <span class="n">outstanding</span><span class="p">;</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">when_all</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">outstanding</span><span class="p">),</span>
|
||||||
|
<span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o"><</span><span class="kt">int</span><span class="o">>></span><span class="p">,</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></span> <span class="n">result</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre><p>Values which are given to such a free function are preserved and later passed to the result handler:</p><pre class="m-code"><span class="n">cti</span><span class="o">::</span><span class="n">when_seq</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span>
|
||||||
|
<span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="kt">int</span> <span class="n">r0</span><span class="p">,</span> <span class="kt">int</span> <span class="n">r1</span><span class="p">,</span> <span class="kt">int</span> <span class="n">r2</span><span class="p">,</span>
|
||||||
|
<span class="kt">int</span> <span class="n">r3</span><span class="p">,</span> <span class="kt">int</span> <span class="n">r4</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre><p>When combining both capabilities it's even possible do something like this:</p><pre class="m-code"><span class="n">cti</span><span class="o">::</span><span class="n">when_all</span><span class="p">(</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
|
||||||
|
<span class="mi">2</span><span class="p">,</span> <span class="c1">//< See this plain value</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">populate</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">3</span><span class="p">),</span> <span class="c1">// Creates a runtime</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">4</span><span class="p">)),</span> <span class="c1">// sized container.</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">make_tuple</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">5</span><span class="p">))))</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="kt">int</span> <span class="n">r0</span><span class="p">,</span> <span class="kt">int</span> <span class="n">r1</span><span class="p">,</span> <span class="kt">int</span> <span class="n">r2</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o"><</span><span class="kt">int</span><span class="o">></span> <span class="n">r34</span><span class="p">,</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o"><</span><span class="kt">int</span><span class="o">>></span> <span class="n">r5</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre></section><section id="tutorial-connecting-continuables-populate"><h2><a href="#tutorial-connecting-continuables-populate">Populating a container from arbitrary continuables</a></h2><p><a href="group___connections.html#ga4f6ecedf4b4ccd5e1c28d937ad717b32" class="m-dox">populate</a> mainly helps to create a homogeneous container from a runtime known count of continuables which type isn't exactly known. All continuables which are passed to this function should be originating from the same source or a method called with the same types of arguments:</p><pre class="m-code"><span class="c1">// cti::populate just creates a std::vector from the two continuables.</span>
|
||||||
|
<span class="k">auto</span> <span class="n">v</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">populate</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">1</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">2</span><span class="p">;</span> <span class="n">i</span> <span class="o"><</span> <span class="mi">5</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// It is possible to add more continuables</span>
|
||||||
|
<span class="c1">// to the container afterwards</span>
|
||||||
|
<span class="n">container</span><span class="p">.</span><span class="n">emplace_back</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="n">i</span><span class="p">));</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">when_all</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o"><</span><span class="kt">int</span><span class="o">></span> <span class="n">resolved</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre></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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
189
tutorial-creating-continuables.html
Normal file
189
tutorial-creating-continuables.html
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
<!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>Tutorial » Creating continuables | 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" id="m-navbar-current">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">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>
|
||||||
|
<span class="m-breadcrumb"><a href="tutorial.html">Tutorial</a> »</span>
|
||||||
|
|
||||||
|
Creating continuables
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p>Explains how to create a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#tutorial-creating-continuables-ready">From a value or exception</a></li>
|
||||||
|
<li><a href="#tutorial-creating-continuables-promises">From a promise taking callable</a></li>
|
||||||
|
<li><a href="#tutorial-creating-continuables-invocation">The continuable invocation model</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<p>A <a href="group___types.html#ga7c8df37fa79b1da94a876e8fc590783c" class="m-dox">continuable</a> is an arbitrary instantiation of a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>, it represents the main class of the library and makes it possible to build up an asynchronous call hierarchy. When dealing with continuables we usually don't know its exact type for avoiding expensive type erasure.</p><p>The <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> is convertible to a <a href="group___types.html#ga7c8df37fa79b1da94a876e8fc590783c" class="m-dox">continuable</a> which represents a specified type of the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> on the cost of a type erasure.</p><section id="tutorial-creating-continuables-ready"><h2><a href="#tutorial-creating-continuables-ready">From a value or exception</a></h2><p>The library provides <a href="group___base.html#gaa638513fe4c0a80b9ad445f8dff91250" class="m-dox">make_<wbr />ready_<wbr />continuable</a> which may be used to create a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> from an arbitrary amount of values:</p><pre class="m-code"><span class="k">auto</span> <span class="n">one</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">continuable</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="kt">float</span><span class="p">,</span> <span class="kt">char</span><span class="o">></span> <span class="n">three</span> <span class="o">=</span>
|
||||||
|
<span class="n">cti</span><span class="o">::</span><span class="n">make_ready_continuable</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mf">1.f</span><span class="p">,</span> <span class="sc">'2'</span><span class="p">);</span></pre><aside class="m-note m-info"><h4>Note</h4><p>In most situations you will never use <a href="group___base.html#gaa638513fe4c0a80b9ad445f8dff91250" class="m-dox">make_<wbr />ready_<wbr />continuable</a> because the library is capable of working with plain values directly and thus this burdens unnecessary overhead.</p></aside><p>Additionally a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> which resolves with an exception may be created through <a href="group___base.html#ga41794c321aef916f4fd0fe4c36aa9e6e" class="m-dox">make_<wbr />exceptional_<wbr />continuable</a>.</p><pre class="m-code"><span class="n">cti</span><span class="o">::</span><span class="n">continuable</span><span class="o"><</span><span class="kt">int</span><span class="o">></span> <span class="n">c</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_exceptional_continuable</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="p">{});</span></pre></section><section id="tutorial-creating-continuables-promises"><h2><a href="#tutorial-creating-continuables-promises">From a promise taking callable</a></h2><p>The main function for creating a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> is <a href="group___base.html#gaf47869ea139d88976af5b9654d6d61c0" class="m-dox">make_<wbr />continuable</a> which must be invoked with the types of arguments it resolves to. It accepts a callable object which accepts an arbitrary object (the <a href="classcti_1_1promise__base.html" class="m-dox">promise_<wbr />base</a>). The <a href="classcti_1_1promise__base.html" class="m-dox">promise_<wbr />base</a> is created by the library and then passed to the given callback. This is in contrast to the usage of the standard <code>std::promise</code> which is created by the user.</p><p>The <a href="classcti_1_1promise__base.html" class="m-dox">promise_<wbr />base</a> exposes methods to resolve it through result values or through an exception. Below we implement pseudo <code>http_request</code> function which resolves the request asynchronously trough a <code>std::string</code>.</p><pre class="m-code"><span class="k">auto</span> <span class="nf">http_request</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">url</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">return</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></span><span class="p">(</span>
|
||||||
|
<span class="p">[</span><span class="n">url</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">url</span><span class="p">)](</span><span class="k">auto</span><span class="o">&&</span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Resolve the promise upon completion of the task.</span>
|
||||||
|
<span class="n">promise</span><span class="p">.</span><span class="n">set_value</span><span class="p">(</span><span class="s">"<html> ... </html>"</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="c1">// Or promise.set_exception(...);</span>
|
||||||
|
<span class="p">});</span>
|
||||||
|
<span class="p">}</span></pre><p>An alternative would be a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> with a result of zero arguments:</p><pre class="m-code"><span class="k">auto</span> <span class="nf">wait_for</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">chrono</span><span class="o">::</span><span class="n">milliseconds</span> <span class="n">duration</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">return</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o"><</span><span class="kt">void</span><span class="o">></span><span class="p">([](</span><span class="k">auto</span><span class="o">&&</span> <span class="n">promise</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ^^^^</span>
|
||||||
|
|
||||||
|
<span class="c1">// Resolve the promise later when the duration is over</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><p>A <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> may resolve with an arbitrary count of result values:</p><pre class="m-code"><span class="k">auto</span> <span class="nf">resolve_sth</span><span class="p">()</span> <span class="p">{</span>
|
||||||
|
<span class="k">return</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_continuable</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="kt">int</span><span class="p">,</span> <span class="kt">float</span><span class="p">,</span> <span class="kt">char</span><span class="o">></span><span class="p">(</span>
|
||||||
|
<span class="p">[](</span><span class="k">auto</span><span class="o">&&</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">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mf">2.f</span><span class="p">,</span> <span class="sc">'3'</span><span class="p">);</span>
|
||||||
|
<span class="p">});</span></pre><aside class="m-note m-danger"><h4>Warning</h4><p>A <a href="classcti_1_1promise__base.html" class="m-dox">promise_<wbr />base</a> is only usable once and thus invalidated after it was resolved!</p></aside><p>A <a href="classcti_1_1promise__base.html" class="m-dox">promise_<wbr />base</a> always exposes a call operator for resolving it as like when using <a href="classcti_1_1promise__base.html#a223d666944a70441b3837b461b1094c7" class="m-dox">promise_base::<wbr />set_value</a> or <a href="classcti_1_1promise__base.html#a609a8cd2ccd43010b154ee0be6165be1" class="m-dox">promise_base::<wbr />set_exception</a>. See <a href="classcti_1_1promise__base.html" class="m-dox">promise_<wbr />base</a> for details.</p><aside class="m-note m-info"><h4>Note</h4><p>In order to make proper use of a <a href="classcti_1_1promise__base.html" class="m-dox">promise_<wbr />base</a> you should move it around, store it for later use and resolve it when the asynchronous task was finished or rejected.</p></aside></section><section id="tutorial-creating-continuables-invocation"><h2><a href="#tutorial-creating-continuables-invocation">The continuable invocation model</a></h2><p>An asynchronous call hierarchy that is stored inside the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> is executed when its result is requested (lazy evaluation) in contrast to other commonly used implementations such as <code>std::future</code> which execute the asynchronous call hierarchy instantly on creation (eager evaluation).</p><p>The lazy evaluation strategy used by continuables has many benefits over eager evaluation that is used by other common implementations:</p><ul><li>prevention of side effects</li><li>evasion of race conditions</li><li>ensured deterministic behaviour.</li></ul><p>The asynchronous call hierarchy is started when the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> is destructed or the <a href="classcti_1_1continuable__base.html#a26ca692e597ebd8beff7d58d8bf584f4" class="m-dox">continuable_base::<wbr />done</a> method is called. It is possible to disable the automatic start through calling <a href="classcti_1_1continuable__base.html#a3c8d7fefc2f65fcd474c99d821809d24" class="m-dox">continuable_base::<wbr />freeze</a> on the corresponding <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</p><aside class="m-note m-warning"><h4>Attention</h4><p>A <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> is not designed to be stored permanently, make sure you call <a href="classcti_1_1continuable__base.html#a3c8d7fefc2f65fcd474c99d821809d24" class="m-dox">continuable_base::<wbr />freeze</a> before storing it and start the continuation chain later through calling <a href="classcti_1_1continuable__base.html#a26ca692e597ebd8beff7d58d8bf584f4" class="m-dox">continuable_base::<wbr />done</a>.</p></aside></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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
176
tutorial-promisify-continuables.html
Normal file
176
tutorial-promisify-continuables.html
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
<!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>Tutorial » Promisify functions | 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" id="m-navbar-current">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">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>
|
||||||
|
<span class="m-breadcrumb"><a href="tutorial.html">Tutorial</a> »</span>
|
||||||
|
|
||||||
|
Promisify functions
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p>Explains how to promisify callback taking functions into a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#tutorial-promisify-continuables-promisify">Promisification and continuables</a></li>
|
||||||
|
<li><a href="#tutorial-promisify-continuables-boost">Promisify boost::asio</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<section id="tutorial-promisify-continuables-promisify"><h2><a href="#tutorial-promisify-continuables-promisify">Promisification and continuables</a></h2><p>The promisification has a longer history in the JavaScript world where the legacy way of asynchronous programming was the usage of callbacks of the form <code class="m-code"><span class="kd">function</span><span class="p">(</span><span class="nx">error</span><span class="p">,</span> <span class="nx">result</span><span class="p">...)</span></code>. The ideal way of dealing with such an asynchronous result is to return a promise and soon utility helpers were provided to do so.</p><p>The usage of callbacks to represent an asynchronous result is still a popular way nowadays. Thus the library provides the <a href="classcti_1_1promisify.html" class="m-dox">promisify</a> helper class which makes it possible to convert callback taking functions of various styles into one that returns a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> instead.</p><aside class="m-note m-info"><h4>Note</h4><p>Providing promisified APIs for other popular libraries is out of scope for this library. However contributions are highly welcome to add more conversion helpers for other commonly used callback styles.</p></aside></section><section id="tutorial-promisify-continuables-boost"><h2><a href="#tutorial-promisify-continuables-boost">Promisify boost::asio</a></h2><p>The default callback style is something like <code class="m-code"><span class="kd">function</span><span class="p">(</span><span class="nx">error</span><span class="p">,</span> <span class="nx">result</span><span class="p">...)</span></code> as described above. Continuable offers the <a href="classcti_1_1promisify.html#a28834d45efa0e6d2e22771cdd38e33a4" class="m-dox">promisify::<wbr />from</a> method for such callback styles.</p><p>See an example of how to promisify boost asio's <code>async_resolve</code> below:</p><pre class="m-code"><span class="k">auto</span> <span class="nf">async_resolve</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">host</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">service</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="k">return</span> <span class="n">cti</span><span class="o">::</span><span class="n">promisify</span><span class="o"><</span><span class="n">asio</span><span class="o">::</span><span class="n">ip</span><span class="o">::</span><span class="n">udp</span><span class="o">::</span><span class="n">resolver</span><span class="o">::</span><span class="n">iterator</span><span class="o">>::</span><span class="n">from</span><span class="p">(</span>
|
||||||
|
<span class="p">[</span><span class="o">&</span><span class="p">](</span><span class="k">auto</span><span class="o">&&</span><span class="p">...</span> <span class="n">args</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="n">resolver_</span><span class="p">.</span><span class="n">async_resolve</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">forward</span><span class="o"><</span><span class="k">decltype</span><span class="p">(</span><span class="n">args</span><span class="p">)</span><span class="o">></span><span class="p">(</span><span class="n">args</span><span class="p">)...);</span>
|
||||||
|
<span class="p">},</span>
|
||||||
|
<span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">host</span><span class="p">),</span> <span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">service</span><span class="p">));</span>
|
||||||
|
<span class="p">}</span></pre><p>Then it should be possible to use <code>asio::async_resolve</code> like this:</p><pre class="m-code"><span class="n">async_resolve</span><span class="p">(</span><span class="s">"127.0.0.1"</span><span class="p">,</span> <span class="s">"daytime"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">udp</span><span class="o">::</span><span class="n">resolver</span><span class="o">::</span><span class="n">iterator</span> <span class="n">iterator</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// ...</span>
|
||||||
|
<span class="p">});</span></pre></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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
178
tutorial-transforming-continuables.html
Normal file
178
tutorial-transforming-continuables.html
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
<!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>Tutorial » Transforming continuables | 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" id="m-navbar-current">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">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>
|
||||||
|
<span class="m-breadcrumb"><a href="tutorial.html">Tutorial</a> »</span>
|
||||||
|
|
||||||
|
Transforming continuables
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p>Explains the conversion into other types such as <code>std::future</code>.</p>
|
||||||
|
<div class="m-block m-default">
|
||||||
|
<h3>Contents</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#tutorial-transforming-continuables-transforms">Transforms in general</a></li>
|
||||||
|
<li><a href="#tutorial-transforming-continuables-future">Conversion into std::future</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<section id="tutorial-transforming-continuables-transforms"><h2><a href="#tutorial-transforming-continuables-transforms">Transforms in general</a></h2><p>Sometimes it's required to change a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> object by its whole. Thus the library offers the ability to apply a transformation to any <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> through using <a href="classcti_1_1continuable__base.html#abcf4cf105aa17826bcc3c2278f6ea1b5" class="m-dox">apply</a> or <a href="classcti_1_1continuable__base.html#ae2d35537ea76f421ba4aed86dd849f98" class="m-dox">its operator |</a>.</p><p>A transformation accepts a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> and returns an arbitrary object.</p><p>To create a transformation use the <a href="group___transforms.html#ga2383cf2e4cf7d8d43efeb25f790be006" class="m-dox">make_<wbr />transform</a> function:</p><pre class="m-code"><span class="k">auto</span> <span class="n">transform</span> <span class="o">=</span> <span class="n">cti</span><span class="o">::</span><span class="n">make_transform</span><span class="p">([]</span> <span class="p">(</span><span class="k">auto</span><span class="o">&&</span> <span class="n">continuable</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Change the continuable</span>
|
||||||
|
<span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">forward</span><span class="o"><</span><span class="k">decltype</span><span class="p">(</span><span class="n">continuable</span><span class="p">)</span><span class="o">></span><span class="p">(</span><span class="n">continuable</span><span class="p">);</span>
|
||||||
|
<span class="p">});</span></pre><p>The library provides several transforms already as part of the <a href="namespacecti_1_1transforms.html" class="m-dox">cti::<wbr />transforms</a> namespace.</p></section><section id="tutorial-transforming-continuables-future"><h2><a href="#tutorial-transforming-continuables-future">Conversion into std::future</a></h2><p>The library is capable of converting (<em>futurizing</em>) every continuable into a fitting <code>std::future</code> through the <a href="group___transforms.html#gac698fd2486d980302cbd956fdeafdfde" class="m-dox">transforms::<wbr />futurize</a> transform:</p><pre class="m-code"><span class="n">std</span><span class="o">::</span><span class="n">future</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">></span> <span class="n">future</span> <span class="o">=</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"github.com"</span><span class="p">)</span>
|
||||||
|
<span class="p">.</span><span class="n">then</span><span class="p">([](</span><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">response</span><span class="p">)</span> <span class="p">{</span>
|
||||||
|
<span class="c1">// Do sth...</span>
|
||||||
|
<span class="k">return</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"travis-ci.org"</span><span class="p">)</span> <span class="o">||</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">);</span>
|
||||||
|
<span class="p">})</span>
|
||||||
|
<span class="p">.</span><span class="n">apply</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">transforms</span><span class="o">::</span><span class="n">futurize</span><span class="p">());</span>
|
||||||
|
<span class="c1">// ^^^^^^^^</span></pre><p>Multiple arguments which can't be handled by <code>std::future</code> itself are converted into <code>std::tuple</code>, see <a href="group___transforms.html#gac698fd2486d980302cbd956fdeafdfde" class="m-dox">transforms::<wbr />futurize</a> for details.</p><pre class="m-code"><span class="n">std</span><span class="o">::</span><span class="n">future</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">tuple</span><span class="o"><</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">>></span> <span class="n">future</span> <span class="o">=</span>
|
||||||
|
<span class="p">(</span><span class="n">http_request</span><span class="p">(</span><span class="s">"travis-ci.org"</span><span class="p">)</span> <span class="o">&&</span> <span class="n">http_request</span><span class="p">(</span><span class="s">"atom.io"</span><span class="p">))</span>
|
||||||
|
<span class="p">.</span><span class="n">apply</span><span class="p">(</span><span class="n">cti</span><span class="o">::</span><span class="n">transforms</span><span class="o">::</span><span class="n">futurize</span><span class="p">());</span></pre></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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
158
tutorial.html
Normal file
158
tutorial.html
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
<!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>Tutorial | 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" id="m-navbar-current">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" id="m-navbar-current">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">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>
|
||||||
|
Tutorial
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p>An introduction for using the continuable library.</p>
|
||||||
|
<p>This tutorial will give a short overview about using the library. We assume that the library is available in your current environment, if not, follow the <a href="installation.html" class="m-dox">Installation</a> section in order to get it to work.</p><p>This tutorial is split across multiple chapters which should be read in order:</p><ul><li><a href="tutorial-creating-continuables.html" class="m-dox">Creating continuables</a> — Explains how to create a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</li><li><a href="tutorial-chaining-continuables.html" class="m-dox">Chaining continuables</a> — Explains how to chain multiple <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects together.</li><li><a href="tutorial-connecting-continuables.html" class="m-dox">Connecting continuables</a> — Explains how to connect various <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> objects together.</li><li><a href="tutorial-transforming-continuables.html" class="m-dox">Transforming continuables</a> — Explains the conversion into other types such as <code>std::future</code>.</li><li><a href="tutorial-awaiting-continuables.html" class="m-dox">Awaiting continuables</a> — Explains how to use the <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a> together with <code>co_await</code>.</li><li><a href="tutorial-promisify-continuables.html" class="m-dox">Promisify functions</a> — Explains how to promisify callback taking functions into a <a href="classcti_1_1continuable__base.html" class="m-dox">continuable_<wbr />base</a>.</li></ul>
|
||||||
|
</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">…</div>
|
||||||
|
</div>
|
||||||
|
<div class="m-dox-search-content">
|
||||||
|
<input type="search" id="search-input" placeholder="Loading …" 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">↓</span> and
|
||||||
|
<span class="m-label m-dim">↑</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–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>
|
||||||
Loading…
x
Reference in New Issue
Block a user