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…
Reference in New Issue