Appending static arrays

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


On Monday, 17 July 2017 at 19:11:26 UTC, H. S. Teoh wrote:
> Hmm, since we already have sumOfLengths available at 
> compile-time, what about:
>
>  	T[sumOfLengths!StaticArrays] 
> append(StaticArrays...)(StaticArrays arrays)
>  		if (allSatisfy!(isStaticArray, StaticArrays))
>  	{
>  		typeof(return) result = void;
>  		foreach (i, a; 0 .. arrays.length)
>  		{
> 			enum offset = sumOfLengths!(arrays[0 .. i]);
>  			result[offset .. offset + a.length] = a[];
>  		}
>  		return result;
>  	}
>
>
> T

Thanks, I'll try this!

Does this have a place in Phobos?

If so,

- under what name: append, concat or cat?
- where: std.algorithm or std.array?



More information about the Digitalmars-d-learn mailing list