2019-03-12 02:32:08 +00:00
|
|
|
template init*(lvalue: var auto) =
|
2018-12-18 15:39:39 +00:00
|
|
|
mixin init
|
2019-03-12 02:32:08 +00:00
|
|
|
lvalue = init(type(lvalue))
|
|
|
|
|
|
|
|
template init*(lvalue: var auto, a1: auto)=
|
|
|
|
mixin init
|
|
|
|
lvalue = init(type(lvalue), a1)
|
|
|
|
|
|
|
|
template init*(lvalue: var auto, a1, a2: auto) =
|
|
|
|
mixin init
|
|
|
|
lvalue = init(type(lvalue), a1, a2)
|
|
|
|
|
|
|
|
template init*(lvalue: var auto, a1, a2, a3: auto) =
|
|
|
|
mixin init
|
|
|
|
lvalue = init(type(lvalue), a1, a2, a3)
|
2018-12-18 15:39:39 +00:00
|
|
|
|
2019-07-02 23:30:49 +00:00
|
|
|
when not declared(default):
|
|
|
|
proc default*(T: type): T = discard
|
|
|
|
|
2019-07-24 10:39:34 +00:00
|
|
|
proc toArray*[T](N: static int, data: openarray[T]): array[N, T] =
|
|
|
|
doAssert data.len == N
|
|
|
|
copyMem(addr result[0], unsafeAddr data[0], N)
|
|
|
|
|
2019-08-02 08:51:04 +00:00
|
|
|
template anonConst*(val: untyped): untyped =
|
|
|
|
const c = val
|
|
|
|
c
|