cti::transforms namespace

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

Contents

Transforms can be applied to continuables through using the cti::continuable_base::apply method accordingly.

Functions

auto to_future() -> auto
Returns a transform that if applied to a continuable, it will start the continuation chain and returns the asynchronous result as std::future<...>.
auto wait() -> auto
Returns a transform that if applied to a continuable, it will start the continuation chain and returns the result synchronously. The current thread is blocked until the continuation chain is finished.
template<typename Rep, typename Period>
auto wait_for(std::chrono::duration<Rep, Period> duration) -> auto
Returns a transform that if applied to a continuable, it will start the continuation chain and returns the result synchronously. The current thread is blocked until the continuation chain is finished.
template<typename Clock, typename Duration>
auto wait_until(std::chrono::time_point<Clock, Duration> time_point) -> auto
Returns a transform that if applied to a continuable, it will start the continuation chain and returns the result synchronously. The current thread is blocked until the continuation chain is finished.

Function documentation

auto cti::transforms::to_future()

Returns a transform that if applied to a continuable, it will start the continuation chain and returns the asynchronous result as std::future<...>.

Returns

Returns a std::future<...> which becomes ready as soon as the the continuation chain has finished. The signature of the future depends on the result type:

Continuation typeReturn type
continuable_base with <>std::future<void>
continuable_base with <Arg>std::future<Arg>
continuable_base with <Args...>std::future<std::tuple<Args...>>

auto cti::transforms::wait()

Returns a transform that if applied to a continuable, it will start the continuation chain and returns the result synchronously. The current thread is blocked until the continuation chain is finished.

Returns

Returns a value that is available immediately. The signature of the future depends on the result type:

Continuation typeReturn type
continuable_base with <>void
continuable_base with <Arg>Arg
continuable_base with <Args...>std::tuple<Args...>
Exceptions
wait_transform_canceled_exception if the awaited continuable_base is cancelled, and thus was resolved with a default constructed exception type.

template<typename Rep, typename Period>
auto cti::transforms::wait_for(std::chrono::duration<Rep, Period> duration)

Returns a transform that if applied to a continuable, it will start the continuation chain and returns the result synchronously. The current thread is blocked until the continuation chain is finished.

Returns

Returns a result that is available immediately. The signature of the future depends on the result type:

Continuation typeReturn type
continuable_base with <>result<>
continuable_base with <Arg>result<Arg>
continuable_base with <Args...>result<Args...>

template<typename Clock, typename Duration>
auto cti::transforms::wait_until(std::chrono::time_point<Clock, Duration> time_point)

Returns a transform that if applied to a continuable, it will start the continuation chain and returns the result synchronously. The current thread is blocked until the continuation chain is finished.

Returns

Returns a result that is available immediately. The signature of the future depends on the result type:

Continuation typeReturn type
continuable_base with <>result<>
continuable_base with <Arg>result<Arg>
continuable_base with <Args...>result<Args...>