TypeFunction example creatiing a conversion matrix

Stefan Koch uplink.coder at googlemail.com
Thu Oct 1 17:55:17 UTC 2020


On Thursday, 1 October 2020 at 17:50:39 UTC, Andrei Alexandrescu 
wrote:
> On 10/1/20 1:45 PM, Stefan Koch wrote:
>> On Thursday, 1 October 2020 at 17:35:51 UTC, Andrei 
>> Alexandrescu wrote:
>>> On 10/1/20 1:26 PM, Steven Schveighoffer wrote:
>>>> [...]
>>>
>>> How do you implement Variant.get(T) without reifying is(T : 
>>> U)?
>> 
>> What does it do?
>> is Variant.get returning type T ?
>
> Yes: https://dlang.org/phobos/std_variant.html#.VariantN.get
>
>> Then I would assume you don't.
>> You use a template + typeid that's what they are for!
>> 
>> Variant.get is not doing any type computation which you would 
>> need is (T : U) for?
>> Where would I use it?
>
> Everywhere Variant.get is called. The decision is(T : U) needs 
> to be carried, except that one of the types is available only 
> at runtime.

Please show me in the code where is(T : U) is used.
I don't find it in std variant.


More information about the Digitalmars-d mailing list