diff options
Diffstat (limited to 'lib/system.nim')
-rwxr-xr-x | lib/system.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/system.nim b/lib/system.nim index e56a7916e..a60433e57 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -168,9 +168,6 @@ proc `..`*[T](b: T): TSlice[T] {.noSideEffect, inline.} = ## `slice`:idx: operator that constructs an interval ``[default(T), b]`` result.b = b -proc contains*[T](s: TSlice[T], value: T): bool {.noSideEffect, inline.} = - result = value >= s.a and value <= s.b - when not defined(niminheritable): {.pragma: inheritable.} @@ -672,6 +669,9 @@ proc contains*[T](x: set[T], y: T): bool {.magic: "InSet", noSideEffect.} ## is achieved by reversing the parameters for ``contains``; ``in`` then ## passes its arguments in reverse order. +proc contains*[T](s: TSlice[T], value: T): bool {.noSideEffect, inline.} = + result = s.a <= value and value <= s.b + template `in` * (x, y: expr): expr {.immediate.} = contains(y, x) template `not_in` * (x, y: expr): expr {.immediate.} = not contains(y, x) |