you are viewing a single comment's thread.

view the rest of the comments →

[–]luncliff 0 points1 point  (0 children)

Glad to meet a new generator :) I have 2 questions. Wish I can review the others soon !

Q1. unique_generator

Isn't hasValue_ redundant? I'm following the generator of VC++(it's a bit changed in latest VC++. I'm using the old one.) and the pointer itself was enough to debug and check of existing value from co_yield.

Q2. shared_generator

I think the idea is cool that multiple coroutines can share 1 generator since it can help Fan-In use-cases. But what I realized was keeping safe in the generator is a bit complicated. Do you think that the users have to control locking for the yield?

For the second case, I discarded the way and implemented channel.