RangeIterator

struct RangeIterator

The shared integer iterator for half-open and closed ranges.

inclusive_upper controls whether equality with upper yields one final value. done records exhaustion explicitly so Int.max can be a closed endpoint without incrementing to an unrepresentable sentinel.

Properties

let lower: Int

The inclusive lower bound.

let upper: Int

The terminal bound shared by half-open and inclusive iteration.

let inclusive_upper: Bool

Whether equality with upper still yields one final value.

let current: Int

The current value.

let done: Bool

Explicit exhaustion: a closed range ending at Int's maximum has no out-of-range sentinel to advance to (incrementing would wrap).