Appending static arrays

Nordlöw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 17 11:35:08 PDT 2017


On Monday, 17 July 2017 at 17:46:42 UTC, ag0aep6g wrote:
> Like so?
>
> int[n + m] append(size_t n, size_t m)(int[n] a, int[m] b)
> {
>     int[n + m] result = a ~ b;
>     return result;
> }

Thanks, but I'm talking about the variadic case where the number 
of input arguments are unknown (>= 2) where the function header 
looks something like

import std.traits : allSatisfy, isStaticArray;

auto append(R, Args...)(auto ref Args args)
     if (args.length >= 2 &&
         allSatisfy!(isStaticArray, Args))
     // TODO all ElementTypes have CommonType
{
     // ...
}



More information about the Digitalmars-d-learn mailing list