I would like to implement the following simple function, but I cannot find an alternative for AnyType (interface?) that defines comparison operators. In the following code a is needed for .
It's as if I'm missing a manual. If someone knows how to do this, or knows how to make me cope that is cannot be done... neai != bi
fn equal_vector[T: AnyType](a: DynamicVector[T], b: DynamicVector[T]) -> Bool:
# assumed a and b are sorted
if a.__len__() != b.__len__():
return False
for i in range (a.__len__()):
let ai: T = a.__getitem__(i)
let bi: T = b.__getitem__(i)
if ai != bi: ## compilation error HERE
return False
return True