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

Add generator overload to internal::file<T> and internal::file_stream<T> #578

Open
5 tasks
SSoelvsten opened this issue Nov 17, 2023 · 0 comments
Open
5 tasks
Labels
✨ code quality Uncle Bob would be proud 🎓 student programmer Work, work...

Comments

@SSoelvsten
Copy link
Owner

SSoelvsten commented Nov 17, 2023

For code clarity (and performance?), we should ditch the make_generator<Stream> in favour of making the streams into generators directly.

Tasks (Internal/IO)

  • Add operator() to internal::file_stream which wraps a pull() into an optional<T>.
  • Add member function ::generator() to internal::file_stream that returns a lambda with a reference to this.
  • Add member function ::generator(bool reverse) to internal::file that creates a (mutable) lambda that carries the internal::file_stream<> inside of it.
  • Replace all uses of make_generator<Stream>; use the stream directly if possible (e.g. zdd_complement()) or one of the above static functions (preferably the one on internal::file).

Tasks (Domain)

  • Add domain_generator(bool reverse) to public API using internal::file<domain_var>::generator().

This can be further extended to make the domain_set(varcount) an O(1) space operation which is always computed on-the-fly.

@SSoelvsten SSoelvsten added the ✨ code quality Uncle Bob would be proud label Nov 17, 2023
@SSoelvsten SSoelvsten added this to the v2.0 : API Revamp milestone Nov 17, 2023
@SSoelvsten SSoelvsten added the 🎓 student programmer Work, work... label Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ code quality Uncle Bob would be proud 🎓 student programmer Work, work...
Projects
None yet
Development

No branches or pull requests

1 participant