nim-stew/stew/objects.nim

20 lines
448 B
Nim
Raw Normal View History

template init*(lvalue: var auto) =
mixin init
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)
2019-07-02 23:30:49 +00:00
when not declared(default):
proc default*(T: type): T = discard