RangeSet containing Integer.min...Integer.max

How would I create, for example, a RangeSet<Int32> which includes an integer's entire range Int32.min...Int32.max?

I think you cannot, since it’s a set of Range, not of ClosedRange. Range uses the upper bound as an exclusive value. Thus, Int32.max cannot be contained by a Range<Int32> and neither by a RangeSet<Int32>.

So I have to duplicate all of its functionality? Would that make sense as a standard library addition? Something like ClosedRangeSet.

1 Like

I’d say RangeExpressionSet, so you could use ranges, closed ranges, one-sided ranges, and unbounded ranges.

2 Likes

FWIW, this reminds me that I once implemented MultipleRanges, which can contain any types of ranges.

2 Likes