mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-05 12:37:46 +00:00
system.nim improvement: make 'len' work with heterogenous slices
This commit is contained in:
@@ -2089,7 +2089,7 @@ proc clamp*[T](x, a, b: T): T =
|
||||
if x > b: return b
|
||||
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
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
|
||||
Reference in New Issue
Block a user