[swift-evolution] [Review] Tiny Update: SE-0065 A New Model for Collections and Indices

Dave Abrahams dabrahams at apple.com
Tue Apr 12 19:52:51 CDT 2016


We realized we neglected to propose this useful API:

    /// Conversion from one range to another.
    extension RangeProtocol where Bound : Strideable, Bound.Stride : Integer {
      /// Creates an instance equivalent to `other`.
      ///
      /// - Precondition: an equivalent range is representable as an
      ///   instance of `Self`.  For example, `Range(0...Int.max)`
      ///   violates this precondition because an equivalent `Range<Int>`
      ///   would need an `upperBound` equal to `Int.max + 1`, which
      ///   is unrepresentable as an `Int`.
      public init<Other: RangeProtocol where Other.Bound == Bound>(_ other: Other)
    }

Please consider it added to the proposal, per
https://github.com/apple/swift-evolution/pull/255/.

-- 
Dave



More information about the swift-evolution mailing list