[swift-evolution] [Swift 3?] Add ContiguousArray -> Array non-copying initialiser

Dmitri Gribenko gribozavr at gmail.com
Thu Jul 28 13:11:17 CDT 2016


On Thu, Jul 28, 2016 at 11:01 AM, Karl Wagner <razielim at gmail.com> wrote:
> I didn't know that normally-copying initialiser was non-copying for
> ContiguousArray. That's the kind of thing we should really document
> somewhere

We would welcome a patch for the docs!

> (or it should be it's own function because it guarantees
> non-copying behaviour).

It should be the same function, so that you get this optimization even
when working from generic code, when the type of the initializer's
argument is erased to Sequence.

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-evolution mailing list