Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
metagn authored Jan 3, 2021
1 parent c71f565 commit 2aed418
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/pure/collections/critbits.nim
Original file line number Diff line number Diff line change
Expand Up @@ -531,13 +531,14 @@ func commonPrefixLen*[T](c: CritBitTree[T]): int {.inline, since((1, 3)).} =
else: c.root.byte
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`.
runnableExamples:
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]

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`.
runnableExamples:
doAssert ["a", "b", "c"].toCritBitTree is CritBitTree[void]
Expand Down

0 comments on commit 2aed418

Please sign in to comment.