mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
@@ -531,13 +531,14 @@ func commonPrefixLen*[T](c: CritBitTree[T]): int {.inline, since((1, 3)).} =
|
|||||||
else: c.root.byte
|
else: c.root.byte
|
||||||
else: 0
|
else: 0
|
||||||
|
|
||||||
func toCritBitTree*[A, B](pairs: openArray[(A, B)]): CritBitTree[A] {.since: (1, 3).} =
|
func toCritBitTree*[T](pairs: openArray[(string, T)]): CritBitTree[T] {.since: (1, 3).} =
|
||||||
## Creates a new `CritBitTree` that contains the given `pairs`.
|
## Creates a new `CritBitTree` that contains the given `pairs`.
|
||||||
runnableExamples:
|
runnableExamples:
|
||||||
doAssert {"a": "0", "b": "1", "c": "2"}.toCritBitTree is CritBitTree[string]
|
doAssert {"a": "0", "b": "1", "c": "2"}.toCritBitTree is CritBitTree[string]
|
||||||
|
doAssert {"a": 0, "b": 1, "c": 2}.toCritBitTree is CritBitTree[int]
|
||||||
for item in pairs: result.incl item[0], item[1]
|
for item in pairs: result.incl item[0], item[1]
|
||||||
|
|
||||||
func toCritBitTree*[T](items: openArray[T]): CritBitTree[void] {.since: (1, 3).} =
|
func toCritBitTree*(items: openArray[string]): CritBitTree[void] {.since: (1, 3).} =
|
||||||
## Creates a new `CritBitTree` that contains the given `items`.
|
## Creates a new `CritBitTree` that contains the given `items`.
|
||||||
runnableExamples:
|
runnableExamples:
|
||||||
doAssert ["a", "b", "c"].toCritBitTree is CritBitTree[void]
|
doAssert ["a", "b", "c"].toCritBitTree is CritBitTree[void]
|
||||||
|
|||||||
Reference in New Issue
Block a user