stdlib: use system.default if it exists
This commit is contained in:
parent
142a2d3551
commit
aed8766e84
2 changed files with 10 additions and 12 deletions
|
|
@ -74,7 +74,8 @@ type
|
|||
|
||||
const growthFactor = 2
|
||||
|
||||
template default[T](t: typedesc[T]): T =
|
||||
when not defined(nimHasDefault):
|
||||
template default[T](t: typedesc[T]): T =
|
||||
## Used by clear methods to get a default value.
|
||||
var v: T
|
||||
v
|
||||
|
|
@ -162,10 +163,6 @@ template doWhile(a, b) =
|
|||
b
|
||||
if not a: break
|
||||
|
||||
template default[T](t: typedesc[T]): T =
|
||||
var v: T
|
||||
v
|
||||
|
||||
proc exclImpl[A](s: var HashSet[A], key: A) : bool {. inline .} =
|
||||
assert s.isValid, "The set needs to be initialized."
|
||||
var hc: Hash
|
||||
|
|
|
|||
|
|
@ -116,7 +116,8 @@ template hasKeyOrPutImpl(enlarge) {.dirty.} =
|
|||
maybeRehashPutImpl(enlarge)
|
||||
else: result = true
|
||||
|
||||
template default[T](t: typedesc[T]): T =
|
||||
when not defined(nimHasDefault):
|
||||
template default[T](t: typedesc[T]): T =
|
||||
var v: T
|
||||
v
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue