mirror of
https://github.com/status-im/nim-stew.git
synced 2025-01-09 11:45:42 +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 =
|
template anonConst*(val: untyped): untyped =
|
||||||
const c = val
|
const c = val
|
||||||
c
|
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