diff options
author | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2013-08-22 23:09:31 +0200 |
---|---|---|
committer | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2013-08-22 23:09:31 +0200 |
commit | b7b19348a72c2ea7695aa9ded0f11d3e2ae34111 (patch) | |
tree | 9ae2ea8be10f0d5b9c95b639c2f52c21229b41e4 | |
parent | a8c8a85135e73777ea2c115bf1352456c1dd69aa (diff) | |
download | Nim-b7b19348a72c2ea7695aa9ded0f11d3e2ae34111.tar.gz |
Adds equality comparison for arrays.
-rw-r--r-- | lib/system.nim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim index 08e4c367b..a0172d650 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1439,6 +1439,12 @@ proc isNil*[T: proc](x: T): bool {.noSideEffect, magic: "IsNil".} ## Fast check whether `x` is nil. This is sometimes more efficient than ## ``== nil``. +proc `==` *[I, T](x, y: array[I, T]): bool = + for f in low(x)..high(x): + if x[f] != y[f]: + return + result = true + proc `@`*[T](a: openArray[T]): seq[T] = ## turns an openarray into a sequence. This is not as efficient as turning ## a fixed length array into a sequence as it always copies every element |