3#ifndef STEP20_GENERATOR_HPP
4#define STEP20_GENERATOR_HPP
14 std::coroutine_handle<>::from_address(address).destroy();
18template <std::movable T>
19struct generator :
private std::unique_ptr<void, decltype(co_destroy)> {
29 this->emplace(std::move(value));
36 result.reset(handle::from_promise(*this).address());
41 using handle = std::coroutine_handle<promise_type>;
50 bool operator==(std::default_sentinel_t)
const {
return this->done(); }
61 auto end()
const {
return std::default_sentinel; }
Definition edit_distance.hpp:11
auto co_destroy
Definition generator.hpp:13
Definition generator.hpp:43
iterator(handle coro)
Definition generator.hpp:48
T value_type
Definition generator.hpp:46
std::ptrdiff_t difference_type
Definition generator.hpp:45
iterator & operator++()
Definition generator.hpp:53
const T & reference
Definition generator.hpp:47
std::input_iterator_tag iterator_category
Definition generator.hpp:44
reference operator*() const
Definition generator.hpp:49
bool operator==(std::default_sentinel_t) const
Definition generator.hpp:50
void operator++(int)
Definition generator.hpp:51
Definition generator.hpp:20
generator get_return_object()
Definition generator.hpp:33
void await_transform()=delete
void unhandled_exception()
Definition generator.hpp:24
std::suspend_never initial_suspend()
Definition generator.hpp:21
void return_void()
Definition generator.hpp:23
std::suspend_always final_suspend() noexcept
Definition generator.hpp:25
std::suspend_always yield_value(T value)
Definition generator.hpp:27
Definition generator.hpp:19
auto begin() const
Definition generator.hpp:60
auto end() const
Definition generator.hpp:61
std::coroutine_handle< promise_type > handle
Definition generator.hpp:41