TypeFunction example creatiing a conversion matrix
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Thu Oct 1 17:50:39 UTC 2020
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:
>>> But when the compiler MUST implement is(T : U), and that expression
>>> is well defined, I don't see why we have to reimplement that feature
>>> in the runtime as well. At least without a compelling example of "the
>>> compiler can't do this as well".
>>
>> 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.
More information about the Digitalmars-d
mailing list