One step out of the TypeInfo stalemate
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Jul 28 15:26:52 UTC 2020
On 7/28/20 10:33 AM, Adam D. Ruppe wrote:
> On Tuesday, 28 July 2020 at 14:28:09 UTC, Andrei Alexandrescu wrote:
>> More progress - now __typeid comes with statically-typed overloads, so
>> whenever T is statically known, typeid(T).whatever() will pick an
>> efficient inlined implementation instead of a virtual call.
>
> What's potentially interesting here is you *might* be able to add an
> alias StaticType = T in there and then do some pseudo-type manipulation
> in CTFE then get the original type back out.
At least in some cases you can use someTypeid.toString inside a mixin.
Also, this:
static if (typeid(T1) == typeid(T2))
becomes a viable alternative to:
static if (is(T1 == T2))
Sadly it's actually longer :o).
> Probably not there yet and might never get there but I think it would be
> cool if it did somehow work at some point.
Yes, great idea to keep an eye out for. Thanks.
More information about the Digitalmars-d
mailing list