The following fragment of code illustrates some simple operations on BDDs using the C++ interface.
Cudd mgr(0,0); BDD x = mgr.bddVar(); BDD y = mgr.bddVar(); BDD f = x * y; BDD g = y + !x; cout << "f is" << (f <= g ? "" : " not") << " less than or equal to g\n";This code creates a manager called
mgrand two variables in it. It then defines two functions
gin terms of the variables. Finally, it prints a message based on the comparison of the two functions. No explicit referencing or dereferencing is required. The operators are overloaded in the intuitive way. BDDs are freed when execution leaves the scope in which they are defined or when the variables referring to them are overwritten.