C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Coroutines: Add explicit initialization by "co_init" operator

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Fri, 11 Aug 2023 12:24:02 +0200
pt., 11 sie 2023 o 11:58 Stefan Sichler via Std-Proposals
<std-proposals_at_[hidden]> napisaƂ(a):
>
> @Jason
> Addendum to my last mail:
> Pls ignore my comment about passing "this" pointer to the promise c-tor, I first have to learn and understand what C++23 "explicit *this object parameter" extension is.
> :-/
>
> Ok, my understanding of coroutines is currently based on C++20 standard.
>

You miss one important thing, Jason said `*this`, not `this`.
https://godbolt.org/z/zT5q4h4hc

```
        template<typename TT>
        task_promise(TT& s)
        {
            std::cout<< "task_promise(TT)\n";
        }

        task_promise()
        {
            std::cout<< "task_promise())\n";
        }

```

And program output is:

```
run
task_promise(TT)
```

>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2023-08-11 10:24:15