Squaring Arrays without Overlapping Array Error
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 7 06:58:17 PDT 2015
On 7/7/15 1:27 AM, jmh530 wrote:
> If I call a function like
>
> int[] square_array(int[] x)
> {
> return x[] *= x[];
> }
>
> I get an error that there is an overlapping array in a vector operation.
Yeah, this seems like an unnecessary limitation for exact matching. In
other words, if your destination array exactly matches one or more of
the arguments, it should be fine. Where the overlapping starts causing
problems is something like this:
x[1..$] *= x[0..$-1];
I would love to see this limitation fixed.
-Steve
More information about the Digitalmars-d-learn
mailing list