We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using coro<int,int>, the return type is not the expected variant<int,int>, but actually int.
coro<int,int>
variant<int,int>
int
see https://think-async.com/Asio/asio-1.30.2/doc/asio/overview/composition/coro.html#asio.overview.composition.coro.result
version 1.30.2
PS D:\workspace\git\vcpkg> .\vcpkg.exe list ... asio:x86-windows-static 1.30.2
coro<int,int> generator_int(any_io_executor) { int i = 0; do { co_yield i++; } while (i < 3); co_return 0; } awaitable<void> test_print() { auto g = generator_int(co_await this_coro::executor); while (g) { auto ret = co_await g.async_resume(use_awaitable); printf("type=%s, value=%d\n", typeid(ret).name(), ret); } printf("end\n"); } int main(int argc, char** argv) { io_context ctx; co_spawn(ctx, test_print(), detached); ctx.run(); }
type=int, value=0 type=int, value=1 type=int, value=2 type=int, value=0 end
This makes it impossible for me to determine whether the return value comes from co_yield or co_return.
co_yield
co_return
(The use of coro<int> is correct, and the return type is optional<int> as expected.)
coro<int>
optional<int>
The text was updated successfully, but these errors were encountered:
That's by design (just missing proper docs). This is mean for when a return may indicate the error by it's value.
Sorry, something went wrong.
No branches or pull requests
When using
coro<int,int>
, the return type is not the expectedvariant<int,int>
, but actuallyint
.see https://think-async.com/Asio/asio-1.30.2/doc/asio/overview/composition/coro.html#asio.overview.composition.coro.result
version 1.30.2
code
output:
This makes it impossible for me to determine whether the return value comes from
co_yield
orco_return
.(The use of
coro<int>
is correct, and the return type isoptional<int>
as expected.)The text was updated successfully, but these errors were encountered: