C++ Logo

std-proposals

Advanced search

Re: async coroutines vs. lambdas

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Thu, 14 May 2020 16:54:53 +0300
On Thu, 14 May 2020 at 16:53, Ville Voutilainen
<ville.voutilainen_at_[hidden]> wrote:
>
> On Thu, 14 May 2020 at 16:31, Marcin Jaczewski via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> > And code like:
> >
> > ```
> > lazy<int> get_custom_lambda() {
> > struct X
> > {
> > int i = 3;
> > lazy<int> operator()(){ co_return i; }
> > } x();
> > return x();
> > }
> >
> > ```
> >
> > This still crash, and this is same code as `get_real_lambda`.
> > How do you like fix it? and what if lambda is not movable?
>
> If I swap those co_return/return, will this code then work?

And follow-up question, what if they're both co_returns?

Received on 2020-05-14 08:58:07