[swift-users] Swift Initializer Generics

Dmitri Gribenko gribozavr at gmail.com
Mon Jan 18 21:24:17 CST 2016


On Mon, Jan 18, 2016 at 7:14 PM, Tyler Fleming Cloutier
<cloutiertyler at aol.com> wrote:
> I will be damned! And that was a fast response too! I absolutely would not ever have thought of extending Float and Double to do this.

The idea is that with Swift generics in most cases you need to find
the set of types that vary among your calls, and then hang a protocol
onto those types.

> That is crafty indeed. Is there a reason to convert to the array to an UnsafeBufferPointer before passing it into the Accelerate function?

Just so that we don't get extra reference counting while passing the
array through layers of wrapping.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/


More information about the swift-users mailing list