src/sliceutils/until

Source   Edit  

An alternative to system...< which, instead of subtracting 1, treats the end of the slice as having a marginal difference from the given number.

Types

Until[T] = object
  val*: T
The type which represents a marginally smaller number than the given T. Source   Edit  
UntilSlice[T; U] = HSlice[T, Until[U]]
Source   Edit  

Procs

func `<`[T](a: T; b: Until[T]): bool {.inline.}
Alias for a < b.val. Source   Edit  
func `<=`[T](a: T; b: Until[T]): bool {.inline.}
Alias for a < b.val. Source   Edit  
func `==`[T](a: T; b: Until[T]): bool {.inline.}
Equality operator for Until and the base type. Always false. Source   Edit  
func `==`[T](a: Until[T]; b: T): bool {.inline.}
Equality operator for Until and the base type. Always false. Source   Edit  
func contains[T, U, V](s: UntilSlice[T, U]; x: V): bool
Checks that x is not equal to s.b.val, then checks if s.a .. s.b.val contains x. Source   Edit  
func len[T, U](s: UntilSlice[T, U]): int
Returns the value of len(s.a .. s.b.val) and subtracts 1 if s.b.val is in s.a .. s.b.val. Source   Edit  
func until[T, U](a: T; b: U): UntilSlice[T, U] {.inline.}
Initializer of a slice with lower bound a and upper bound marginally below b. Source   Edit  
func until[T](a: T): Until[T] {.inline.}
Initializer of a value marginally smaller than a Source   Edit  

Iterators

iterator items[T, U](s: UntilSlice[T, U]): auto {.noSideEffect.}
Iterates over items(s.a .. s.b.val) and yields all the values that are not equal to s.b.val. Source   Edit