simple template constraint - compile error.
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jun 7 20:11:36 PDT 2015
On Sunday, 7 June 2015 at 23:13:14 UTC, anonymous wrote:
>> int arrayByteSize(T)(T[] someArray) if (isDynamicArray(T))
>
> You forgot an exclamation mark here. Make that:
> isDynamicArray!(T)
Also, if you pass int[] to that function, for example, T will
*not* be int[] - it will actually be int.
(T)(T[])
means take an array of T. If you pass int[], it is an array of
int, so that's why T is just int instead of an array.
You probably want to remove that [] from the signature.
More information about the Digitalmars-d-learn
mailing list