Open mfernan2 opened 4 years ago
These functions are implemented in the header kitty/operators.hpp
.
Ah thanks! I did not even notice these. FWIW I ended up implementing something pretty similar but using SFINAE to ensure the functions are only callable with truth tables:
template<typename T1, typename T2,
// make this only compile for Kitty’s truth table types
typename std::enable_if<kitty::is_truth_table<T1>::value && kitty::is_truth_table<T2>::value>::type* = nullptr>
static bool equal(const T1 &x, const T2 &y) {
...
Actually I just realized why I ran into this issue in the first place. Kitty does not implement operator==
for a dynamic truth table compared to a static truth table. I.e.:
template<int NumVars>
bool operator==( const static_truth_table<NumVars>& first, const dynamic_truth_table& second );
Would it be possible to implement a comparator that handles this case as well? I do not seem to have the ability to re-open this issue.
That's a good point.
static_truth_table
anddynamic_truth_table
do not implementoperator==
andoperator!=
, so code likett1 == tt2
does not work. It seems you still can compare truth tables with something like the following (untested) code:Is it possible to implement
operator==
andoperator!=
on these classes to avoid having to do this? It should be possible to do some template-based specialization to optimize these too.OTOH perhaps I've misunderstood something and equality comparison makes no sense on these classes. In which case, I would be interested to learn of this too.