Adding equality operator for Arrays
Comparison between Arrays is something that is, with arrays being one of the base types in Pascal, really common. Yet the current way of doing this is always having to fully write down:
isequal:=length(arr1)=length(arr2);
if isequal then
for i:=0 to length(arr1)-1 do
if arr1[low(arr1)+i]<>arr2[low(arr2)+i] then
begin
isequal:=False;
break;
end;
And we already got this neat modeswitch ArrayOperators
, which right now, even though it's in plural, only adds the + operator.
So I've also added, when this modeswitch is available the =
and <>
operators. For two arrays it does the loop described above, for comparison between an array and an array constructor it unrolls the array constructor, avoiding looping and all that fuzz, and should thereby be more efficient.
Edited by Frederic Kehrein