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
|
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.
|
## Used by clear methods to get a default value.
|
||||||
var v: T
|
var v: T
|
||||||
v
|
v
|
||||||
|
|
@ -162,10 +163,6 @@ template doWhile(a, b) =
|
||||||
b
|
b
|
||||||
if not a: break
|
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 .} =
|
proc exclImpl[A](s: var HashSet[A], key: A) : bool {. inline .} =
|
||||||
assert s.isValid, "The set needs to be initialized."
|
assert s.isValid, "The set needs to be initialized."
|
||||||
var hc: Hash
|
var hc: Hash
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,8 @@ template hasKeyOrPutImpl(enlarge) {.dirty.} =
|
||||||
maybeRehashPutImpl(enlarge)
|
maybeRehashPutImpl(enlarge)
|
||||||
else: result = true
|
else: result = true
|
||||||
|
|
||||||
template default[T](t: typedesc[T]): T =
|
when not defined(nimHasDefault):
|
||||||
|
template default[T](t: typedesc[T]): T =
|
||||||
var v: T
|
var v: T
|
||||||
v
|
v
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue