Appending static arrays
H. S. Teoh via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jul 17 13:53:36 PDT 2017
On Mon, Jul 17, 2017 at 08:28:12PM +0000, Nordlöw via Digitalmars-d-learn wrote:
[...]
> 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?
See the working implementation in my latest post on this thread. That
version supports CommonType, and works correctly with empty tuples as
well.
T
--
Trying to define yourself is like trying to bite your own teeth. -- Alan Watts
More information about the Digitalmars-d-learn
mailing list