TypeFunction example creatiing a conversion matrix

Andrei Alexandrescu SeeWebsiteForEmail at erdani.com
Thu Oct 1 18:32:21 UTC 2020


On 10/1/20 2:26 PM, Steven Schveighoffer wrote:
> On 10/1/20 2:10 PM, Andrei Alexandrescu wrote:
>> On 10/1/20 1:55 PM, Stefan Koch wrote:
>>> Please show me in the code where is(T : U) is used.
>>> I don't find it in std variant.
>>
>> It's in the use of ImplicitConversionTargets in std.traits.
> 
> The only use of is(T:U) in that trait is:
> 
> is(T : typeof(null))

Of course. That's the point - the template is not using "is", because it 
can't: it only has one type available. It "implements" a subset of it. 
See what I'm saying? ImplicitConversionTargets helps Variant implement a 
kinda sorta "is" at runtime.



More information about the Digitalmars-d mailing list