Just spitballing, but you can write a comparison function and use it instead of an operator ==. Enum type checking for functional parameters is more stringent:
enum A{x}
enum B{y=0}
bool compare(A a, A b) {
return a == b;
}
void main() {
import std.stdio;
A a = A.x;
if (compare(a, B.y)) {
writeln("Indeed.");
}
}
test100.d (11): Error: function test100.compare (A a, A b) cannot be called using argument types (A, B)
this kind of sux tho.
source
share