opConcatAll?

jmh530 john.michael.hall at gmail.com
Thu Jul 2 16:20:45 UTC 2020


On Thursday, 2 July 2020 at 15:47:39 UTC, Steven Schveighoffer 
wrote:
> If I have an array:
>
> int[] arr = [1, 2, 3];
>
> And I use it in a concatenation chain:
>
> auto newArr = [0] ~ arr ~ [4, 5, 6];
>
> [snip]

With a few small changes, you could just as easily have written

int[] newArr;
newArr[] = [0, 0, 0] + arr[] + [4, 5, 6];

which is similar to the traditional type of problem that 
expression templates were designed to solve.


More information about the Digitalmars-d mailing list