template<typename Data, typename Hint>
cti::promise_base class

The promise_base makes it possible to resolve an asynchronous continuable through it's result or through an error type.

Use the promise type defined in continuable/continuable_types.hpp, in order to use this class.

If we want to resolve the promise_base 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.

Constructors, destructors, conversion operators

promise_base(Data data) explicit
Constructor accepting the data object.
template<typename OData, std::enable_if_t<std::is_convertible<std::decay_t<OData>, Data>::value>* = nullptr>
promise_base(OData&& data)
Constructor accepting any object convertible to the data object.

Public functions

void operator()(Args... args) &&noexcept
Resolves the continuation with the given values.
void operator()(detail::types::dispatch_error_tag tag, detail::types::error_type exception) &&noexcept
Resolves the continuation with the given exception.
void set_value(Args... args) noexcept
Resolves the continuation with the given values.
void set_exception(detail::types::error_type exception) noexcept
Resolves the continuation with the given exception.

Function documentation

template<typename Data, typename Hint>
void cti::promise_base<Data, Hint>::operator()(Args... args) &&noexcept

Resolves the continuation with the given values.

template<typename Data, typename Hint>
void cti::promise_base<Data, Hint>::operator()(detail::types::dispatch_error_tag tag, detail::types::error_type exception) &&noexcept

Resolves the continuation with the given exception.

template<typename Data, typename Hint>
void cti::promise_base<Data, Hint>::set_value(Args... args) noexcept

Resolves the continuation with the given values.

template<typename Data, typename Hint>
void cti::promise_base<Data, Hint>::set_exception(detail::types::error_type exception) noexcept

Resolves the continuation with the given exception.