libcoro  1.0
Coroutine support library for C++20
coroutine.h
1 #pragma once
2 #include "allocator.h"
3 #include <coroutine>
4 #include <exception>
5 
6 namespace coro {
7 
9 
27 template<coro_allocator Alloc = std_allocator>
29 public:
30  class promise_type: public coro_allocator_helper<Alloc> , public trace::base_promise_type{
31  public:
32  static constexpr std::suspend_never initial_suspend() noexcept {return {};}
33  static constexpr std::suspend_never final_suspend() noexcept {return {};}
34  static constexpr void return_void() {}
35  static void unhandled_exception() {std::terminate();}
36  basic_coroutine get_return_object() const {return {};}
37 
38 
39  promise_type() {
40  trace::set_class(std::coroutine_handle<promise_type>::from_promise(*this), typeid(basic_coroutine).name());
41  }
42 
43  };
44 };
45 
46 
48 
61 
62 }
COROUTINE: Basic coroutine.
Definition: coroutine.h:28
inherit this class to include coro_allocator into your promise_type
Definition: allocator.h:77
main namespace
Definition: aggregator.h:8