mirror of
https://github.com/status-im/nim-stew.git
synced 2025-02-10 03:04:33 +00:00
Add len
for tuples
This commit is contained in:
parent
62c1bebe2e
commit
2bdd2fab6e
@ -24,3 +24,10 @@ proc toArray*[T](N: static int, data: openarray[T]): array[N, T] =
|
||||
template anonConst*(val: untyped): untyped =
|
||||
const c = val
|
||||
c
|
||||
|
||||
when not compiles(len((1, 2))):
|
||||
import typetraits
|
||||
|
||||
func len*(x: tuple): int =
|
||||
arity(type(x))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user