I am trying to compare 2 structs that have dynamic arrays inside of them, here is how the most simple version looks like;
package main
import "core:fmt"
A :: struct {
d: [dynamic]int,
}
main :: proc() {
foo := A{make([dynamic]int)}
bar := A{make([dynamic]int)}
defer delete(foo.d)
defer delete(bar.d)
if (foo == bar) {
fmt.println("they are the same")
} else {
fmt.println("they are not the same")
}
}
when I tryed to run it I get the following error from the compiler
main.odin(15:7) Error: Cannot compare expression. Type 'A' is not simply comparable, so operator '==' is not defined for it.
if (foo == bar) {
^~~~~~~~~^
is there a way to make a struct that is not simply comparable into a struct that is, or is there a way to define the ā==ā operator for that struct.
I tried to find more about this but I could not find anything more. (I am very bad at google seaches)