On Monday, 17 July 2017 at 20:10:31 UTC, H. S. Teoh wrote:
On Mon, Jul 17, 2017 at 08:11:03PM +0000, Nordlöw via Digitalmars-d-learn wrote: [...]
Does this have a place in Phobos?

Never know till you try. :-D


If so,

- under what name: append, concat or cat?

I'd vote for concat.


- where: std.algorithm or std.array?

std.array, IMO, since it's specific to static arrays.


T

Made some adjustments with working unittest and put it up on

https://github.com/nordlow/phobos-next/blob/master/src/algorithm_ex.d#L2467

I had to special-case foreach body for `i == 0` since `sumOfLengths` couldn't instantiate with empty tuple `()`.

Further, should `concat` support `CommonType`? That is, should

    int[2] x = [1, 2];
    const double[2] y = [3, 4];
    auto z = concat(x, y);
    static assert(is(typeof(z) == double[4]));

be allowed?

Reply via email to