Appending static arrays

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 17 12:05:41 PDT 2017


On Mon, Jul 17, 2017 at 12:01:48PM -0700, H. S. Teoh via Digitalmars-d-learn wrote:
[...]
> 	T[sumOfLengths!StaticArrays] append(StaticArrays...)(StaticArrays arrays)
> 		if (/* insert static array constraints here */)
> 	{
> 		typeof(return) result = void;
> 		size_t offset = 0;
> 		foreach (a; arrays)
> 		{
> 			result[offset .. offset + a.length] = a[];

Argh, forgot this important line:

			offset += a.length;


> 		}
> 		return result;
> 	}
[...]


T

-- 
Marketing: the art of convincing people to pay for what they didn't need before which you fail to deliver after.


More information about the Digitalmars-d-learn mailing list