cti namespace

Declares the continuable library namespace.

Contents

The most important class is cti::continuable_base, that provides the whole functionality for continuation chaining.

The class cti::continuable_base is created through the cti::make_continuable() function which accepts a callback taking function.

Also there are following support functions available:

Namespaces

namespace transforms
The namespace transforms declares callable objects that transform any continuable_base to an object or to a continuable_base itself.

Classes

template<typename Data, typename Annotation>
class continuable_base
The main class of the continuable library, it provides the functionality for chaining callbacks and continuations together to a unified hierarchy.
template<template<std::size_t, typename...> class CallbackWrapper, template<std::size_t, typename...> class ContinuationWrapper, typename... Args>
class continuable_trait
Trait to retrieve a continuable_base type with a given type-erasure backend.
template<typename Data, typename Hint>
class promise_base
The promise_base makes it possible to resolve an asynchronous continuable through it's result or through an error type.
template<typename... Result>
class promisify
Helper class for converting callback taking callable types into a a continuable. Various styles are supported.

Typedefs

using dispatch_error_tag = detail::types::dispatch_error_tag
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.
using error_type = detail::types::error_type
Represents the type that is used as error type.
template<typename T>
using is_continuable = detail::base::is_continuable<T>
Deduces to a true_type if the given type is a continuable_base.
template<typename T>
using transform = detail::types::transform<T>
A callable tag object which marks a wrapped callable object as continuable transformation which enables some useful overloads.
using async_traverse_visit_tag = detail::traversal::async_traverse_visit_tag
A tag which is passed to the operator() of the visitor if an element is visited synchronously through traverse_pack_async.
using async_traverse_detach_tag = detail::traversal::async_traverse_detach_tag
A tag which is passed to the operator() of the visitor if an element is visited after the traversal was detached through traverse_pack_async.
using async_traverse_complete_tag = detail::traversal::async_traverse_complete_tag
A tag which is passed to the operator() of the visitor if the asynchronous pack traversal was finished through traverse_pack_async.
template<typename T>
using async_traverse_in_place_tag = detail::traversal::async_traverse_in_place_tag<T>
A tag to identify that a mapper shall be constructed in-place from the first argument passed to traverse_pack_async.
template<typename... Args>
using continuable = typename detail::unique_trait_of<Args...>::continuable
Defines a non-copyable continuation type which uses the function2 backend for type erasure.
template<typename... Args>
using promise = typename detail::unique_trait_of<Args...>::promise
Defines a non-copyable promise type which is using the function2 backend for type erasure.
using work = detail::work
Defines a non-copyable type erasure which is capable of carrying callable objects passed to executors.

Functions

template<typename... Args, typename Continuation>
auto make_continuable(Continuation&& continuation) -> auto constexpr
Creates a continuable_base from a promise/callback taking function.
template<typename... Args>
auto make_ready_continuable() -> auto constexpr
Returns a continuable_base with no result which instantly resolves the promise with no values.
template<typename Result>
auto make_ready_continuable(Result&& result) -> auto constexpr
Returns a continuable_base with one result value which instantly resolves the promise with the given value.
template<typename FirstResult, typename SecondResult, typename... Rest>
auto make_ready_continuable(FirstResult&& first_result, SecondResult&& second_result, Rest&&... rest) -> auto constexpr
Returns a continuable_base with multiple result values which instantly resolves the promise with the given values.
template<typename... Signature, typename Exception>
auto make_exceptional_continuable(Exception&& exception) -> auto constexpr
Returns a continuable_base with the parameterized result which instantly resolves the promise with the given error type.
template<typename... Args>
auto when_all(Args&&... args) -> auto
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.
template<typename Iterator, std::enable_if_t<detail::range::is_iterator<Iterator>::value>* = nullptr>
auto when_all(Iterator begin, Iterator end) -> auto
Connects the given arguments with an all logic. The content of the iterator is moved out and converted to a temporary std::vector which is then passed to when_all.
template<typename... Args>
auto when_seq(Args&&... args) -> auto
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.
template<typename Iterator, std::enable_if_t<detail::range::is_iterator<Iterator>::value>* = nullptr>
auto when_seq(Iterator begin, Iterator end) -> auto
Connects the given arguments with a sequential logic. The content of the iterator is moved out and converted to a temporary std::vector which is then passed to when_seq.
template<typename... Args>
auto when_any(Args&&... args) -> auto
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.
template<typename Iterator, std::enable_if_t<detail::range::is_iterator<Iterator>::value>* = nullptr>
auto when_any(Iterator begin, Iterator end) -> auto
Connects the given arguments with an any logic. The content of the iterator is moved out and converted to a temporary std::vector which is then passed to when_all.
template<template<typename, typename> class C = std::vector, typename First, typename... Args>
auto populate(First&& first, Args&&... args) -> C<std::decay_t<First>, std::allocator<std::decay_t<First>>>
Populates a homogeneous container from the given arguments. All arguments need to be convertible to the first one, by default std::vector is used as container type.
template<typename T>
auto make_transform(T&& callable) -> auto
Wraps the given callable object into a transform class.
template<typename Visitor, typename... T>
auto traverse_pack_async(Visitor&& visitor, T&&... pack) -> auto
Traverses the pack with the given visitor in an asynchronous way.
template<typename Mapper, typename... T>
auto map_pack(Mapper&& mapper, T&&... pack) -> decltype(auto)
Maps the pack with the given mapper.
template<typename... T>
auto spread_this(T&&... args) -> detail::traversal::spreading::spread_box<std::decay_t<T>...> constexpr
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).
template<typename Mapper, typename... T>
void traverse_pack(Mapper&& mapper, T&&... pack)
Traverses the pack with the given visitor.