> On Dec 23, 2015, at 7:50 PM, Félix Cloutier via swift-evolution 
> <[email protected]> wrote:
> 
> The & operator isn't exactly an address-of operator. Does &arr[0] even return 
> a pointer to the inner buffer? When you use & with properties (and possibly 
> with subscripts as well), Swift may create a local, copy the property value 
> to it, pass a pointer to that local, and copy back the output to the property.
> 
> Anyway, you are probably looking for Array.withUnsafe(Mutable?)BufferPointer:
> 
> arr.withUnsafeMutableBufferPointer { foo($0, $0.count) }
> 
> Félix

The comments in the generated header for UnsafeMutablePointer claim that its 
regular init() method constructs a null pointer. Therefore, I think you should 
just be able to:

foo(UnsafeMutablePointer<T>(), 0)

Charles

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to