Re: [swift-users] adopting RandomAccessCollection protocol

2017-03-12 Thread Ole Begemann via swift-users
On 12/03/2017 16:58, Don Giovanni via swift-users wrote: I'm trying to adopt the RandomAccessCollection protocol from a class. I deliberately leave out the func index(before:) function because there is already a default implementation of that function in RandomAccessCollection. I do understand th

[swift-users] adopting RandomAccessCollection protocol

2017-03-12 Thread Don Giovanni via swift-users
public class Container2: RandomAccessCollection { public typealias Indices = DefaultRandomAccessIndices; public typealias Index = Int; //typealias SubSequence = Container2; public var arr:[Int] = [1,2,3,4,5]; public var endIndex: Index { return 5; } public var startIndex:Index{ return 0;

[swift-users] adopting RandomAccessCollection protocol

2017-03-12 Thread Don Giovanni via swift-users
I'm trying to adopt the RandomAccessCollection protocol from a class. I deliberately leave out the func index(before:) function because there is already a default implementation of that function in RandomAccessCollection. I do understand that that function's implementation is required because of