// // Created by selim on 20.04.2022. // #ifndef AUTOCAT_GNOME_CORO_H #define AUTOCAT_GNOME_CORO_H #include #include #if __cpp_lib_coroutine #include namespace corons = std; #else #include namespace corons = std::experimental; #endif template struct corons::coroutine_traits { struct promise_type { void get_return_object() noexcept {} corons::suspend_never initial_suspend() const noexcept { return {}; } corons::suspend_never final_suspend() const noexcept { return {}; } void return_void() noexcept {} void unhandled_exception() noexcept { try { std::rethrow_exception(std::current_exception()); } catch (std::exception& ex) { std::cout << "Unhandled exception (in void coroutine) detected: " << ex.what() << std::endl; } } }; }; #endif //AUTOCAT_GNOME_CORO_H