What does this code snippet even do?

Imperatorn johan_forsberg_86 at hotmail.com
Sat Jan 30 00:12:51 UTC 2021


On Friday, 29 January 2021 at 22:59:14 UTC, H. S. Teoh wrote:
> On Fri, Jan 29, 2021 at 10:41:33PM +0000, WhatMeWorry via 
> Digitalmars-d-learn wrote:
>> [...]
>
> This means: "does the type of 'a' have the form U[], where U is 
> a type that implicitly converts to T?".
>
>
>> [...]
>
> This means: "does the type of 'a' implicitly convert to T[]?".
>
>
> [...]
>> [...]
>
> Colon means "implicitly converts to".
>
> U is a template parameter to an implicit template `U[]`.  It's 
> basically used for pattern-matching the LHS type to some type 
> pattern on the RHS. The general pattern is:
>
> 	is(typeToBeMatched : typePattern, templateParams...)
>
> `typeToBeMatched` is treated as a argument type to be matched 
> against `typePattern` as if it were a template with parameters 
> `templateParams`.
>
>
> T

I wish we could upvote answers 👍


More information about the Digitalmars-d-learn mailing list