the.bay.news

Trouble Forwarding to Mutating Subscript

Swift Forums
Trouble Forwarding to Mutating Subscript
I was trying to write a wrapper around InlineArray with a borrowing & mutating subscript that forwards to the array's subscript (to get a feel for it), but I unexpectedly ended up with an error inside my mutating getter. public struct Vec4<Element: Numeric> { var storage: [4 of Element] public init(_ x: Element, _ y: Element, _ z: Element, _ w: Element) { storage = [x, y, z, w] } public subscript(index: Int) -> Element { borrow { storage[index] } mutate { &storage[index] } ...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.