SSoelvsten/adiar

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

SSoelvsten opened this issue · 0 comments

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.