Container System 0.1.0
High-performance C++20 type-safe container framework with SIMD-accelerated serialization
Loading...
Searching...
No Matches
task.h File Reference

C++20 coroutine task type for async operations. More...

#include <coroutine>
#include <exception>
#include <optional>
#include <utility>
#include <type_traits>
#include <variant>
#include <atomic>
Include dependency graph for task.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  kcenon::container::async::detail::promise_base
 Base promise type with common functionality. More...
 
struct  kcenon::container::async::detail::promise_base::final_awaiter
 Final awaiter that resumes the continuation. More...
 
struct  kcenon::container::async::detail::promise_type< T >
 Promise type for value-returning tasks. More...
 
struct  kcenon::container::async::detail::promise_type< void >
 Promise type for void-returning tasks. More...
 
class  kcenon::container::async::task< T >
 Forward declaration of task. More...
 
struct  kcenon::container::async::task< T >::awaiter
 Awaitable interface. More...
 

Namespaces

namespace  kcenon
 
namespace  kcenon::container
 
namespace  kcenon::container::async
 
namespace  kcenon::container::async::detail
 

Functions

template<typename T >
task< std::decay_t< T > > kcenon::container::async::make_ready_task (T &&value)
 Create a task that returns a value immediately.
 
task< void > kcenon::container::async::make_ready_task ()
 Create a task that completes immediately with no value.
 
template<typename T >
task< T > kcenon::container::async::make_exceptional_task (std::exception_ptr ex)
 Create a task that throws an exception.
 
template<>
task< void > kcenon::container::async::make_exceptional_task< void > (std::exception_ptr ex)
 Specialization for void.
 

Detailed Description

C++20 coroutine task type for async operations.

Provides a lightweight coroutine task type that enables async/await style programming for container operations.

// Example usage:
task<int> compute_async() {
co_return 42;
}
task<void> process() {
int result = co_await compute_async();
}
See also
kcenon::container::async::task

Definition in file task.h.