Appending static arrays

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 17 15:39:12 PDT 2017


On Mon, Jul 17, 2017 at 10:32:14PM +0000, Nordlöw via Digitalmars-d-learn wrote:
> On Monday, 17 July 2017 at 20:01:41 UTC, H. S. Teoh wrote:
[...]
> > 			result[offset .. offset + a.length] = a[];
> 
> This slice assignment doesn't support conversion between different
> element-types, for instance from `int[]` to `double[]`.
> 
> But I'm not convinced that we should allow `CommonType` when operator
> ~ doesn't.

True.  Maybe we should just leave out the `CommonType` thing for now.
Not sure how to express that all element types should be equal in the
sig constraints, though.

(It shouldn't be overly hard to support `CommonType`; just replace the
slice assignment with a manual loop. But yeah, probably not worth the
effort.)


T

-- 
Do not reason with the unreasonable; you lose by definition.


More information about the Digitalmars-d-learn mailing list