on Mon Dec 26 2016, Tony Allevato <[email protected]> wrote:
> On Mon, Dec 26, 2016 at 1:46 PM Xiaodi Wu <[email protected]> wrote: > >> This sounds like what UnsafeMutableRawBufferPointer was designed for, no? >> > > I can understand the desire to write an algorithm like this without going > down to unsafe territory, but yes, that's probably the right > approach—especially since the idea of a non-optional but > not-yet-initialized value is inherently unsafe. It's *very* rarely necessary to drop down to unsafe code for these cases. If you can create a Sequence/Collection that (lazily) represents the values you need in the array, you can easily initialize the array at the point where it's needed without doing a 2-phase dance. -- -Dave _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
