SSoelvsten / adiar

An I/O-efficient implementation of (Binary) Decision Diagrams
https://ssoelvsten.github.io/adiar/
MIT License
24 stars 13 forks source link

Overload API with Ranges #554

Open SSoelvsten opened 1 year ago

SSoelvsten commented 1 year ago

Currently we provide generator and iterator overloads for many algorithms. Yet, if possible we should also provide some container/range based input.

For example, one would hope to write something like the following:

std::vector<int> vars;
for (int i = 0; i < varcount; ++i) {
  vars.push_back(i);
}
f = adiar::bdd_exists(f, vars);

Additional context This was requested by Anna Blume Jakobsen while browsing through the documentation.

SSoelvsten commented 1 year ago

Doing so might actually just be as little as this (and adding a few sanity unit checks)

template<Range>
__bdd
exists(const bdd &f, Range r)
{ return exists(f, r.rbegin(), r.rend()); }

The only complications might be overload resolution due to the implicit conversion construction of generator<bdd::label_type> as we also had to do for bdd_and(...).