system.nim improvement: make 'len' work with heterogenous slices
This commit is contained in:
parent
c4b9e683d2
commit
f90df170e3
1 changed files with 1 additions and 1 deletions
|
|
@ -2089,7 +2089,7 @@ proc clamp*[T](x, a, b: T): T =
|
||||||
if x > b: return b
|
if x > b: return b
|
||||||
return x
|
return x
|
||||||
|
|
||||||
proc len*[T: Ordinal](x: HSlice[T, T]): int {.noSideEffect, inline.} =
|
proc len*[U: Ordinal; V: Ordinal](x: HSlice[U, V]): int {.noSideEffect, inline.} =
|
||||||
## length of ordinal slice, when x.b < x.a returns zero length
|
## length of ordinal slice, when x.b < x.a returns zero length
|
||||||
##
|
##
|
||||||
## .. code-block:: Nim
|
## .. code-block:: Nim
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue