Skip to content

Instantly share code, notes, and snippets.

@ztlpn
Created August 8, 2017 18:30
Show Gist options
  • Save ztlpn/77a0ff1c0537f5ce8f81227c511b028b to your computer and use it in GitHub Desktop.
Save ztlpn/77a0ff1c0537f5ce8f81227c511b028b to your computer and use it in GitHub Desktop.
#include <iostream>
#include <boost/coroutine2/all.hpp>
int main()
{
try
{
using Coro = boost::coroutines2::coroutine<void>;
Coro::pull_type coro([](Coro::push_type & yield)
{
// yield();
throw std::runtime_error("Error");
});
while (coro)
coro();
}
catch (const std::exception & e)
{
std::cerr << "Exception: " << e.what() << std::endl;
return 1;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment