How can I check to see if template type is an array?
Paul Backus
snarwin at gmail.com
Tue Jan 19 22:31:47 UTC 2021
On Tuesday, 19 January 2021 at 22:26:52 UTC, Tim wrote:
> Hi all,
>
> I need to be able to check in a template whether the type given
> is an array type so that I can do some different logic. How can
> I do this? I would have thought that if(is(T == [])) would
> work, but no.
>
>
> Thanks in advance
You've almost got it. The correct syntax is `is(T == U[], U)`.
You can read it as "there exists some type U such that T == U[]".
More information about the Digitalmars-d-learn
mailing list