4 Replies
      Latest reply on Jan 13, 2018 4:43 PM by Gargoyle
      Gargoyle Level 2 Level 2 (70 points)

        I'm trying to get a simple index offset:


        func foo<Bytes: Collection>(data: Bytes) where Bytes.Element == UInt8 {
            let nextFrameStartIndex = data.index(data.startIndex, offsetBy: 10, limitedBy: data.endIndex)


        If I put the integer literal 10 there it compiles just fine.  If I instead create a variable of type Int and pass that I get a compiler error:


        "Cannot invoke 'index' with an argument list of type '(Bytes.Index, offsetBy: Int, limitedBy: Bytes.index)'