Skip to content
New issue

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

Small issues. #2

Open
qis opened this issue Nov 5, 2017 · 0 comments
Open

Small issues. #2

qis opened this issue Nov 5, 2017 · 0 comments

Comments

@qis
Copy link

qis commented Nov 5, 2017

I'll cram everything I find while modifying your async_generator implementation to meet my personal needs in here. Numbers, so that it's easier to answer, if you choose to do so. Hope this helps.

  1. Is your code licensed or licensable?

  2. Shouldn't the move op also destroy the coroutine since the async_generator owns it?

async_generator& operator=(async_generator&& other) {
  // _Coro was renamed to handle_ in my code.
  if (&other != this) {
    if (handle_) {
      handle_.destroy();
    }
    handle_ = std::exchange(other.handle_, nullptr);
  }
}
  1. You're not using the await_iterator::owner boolean anymore.

  2. Inheriting from std::iterator is deprecated, if I'm not mistaken.

using iterator_category = std::input_iterator_tag;
using difference_type = std::ptrdiff_t;
using value_type = T;
using pointer = T*;  // I needed an iterator instead of a const_iterator
using reference = T&;
  1. According to VS 15.4.2 warnings, from_promise taking a pointer is deprecated and accepts the promise by reference.

P.S.: Your code helped me a lot. Thank you! :)

@qis qis changed the title async_generator move op Small issues. Nov 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant