Typeinfo
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Thu Apr 2 22:21:57 PDT 2015
On 4/2/15 9:58 PM, Rikki Cattermole wrote:
> On 3/04/2015 5:34 p.m., Andrei Alexandrescu wrote:
>> On 4/2/15 5:52 PM, Rikki Cattermole wrote:
>>> Small question, how exactly are you getting the TypeInfo without knowing
>>> its exact type at CT?
>>
>> I just use it at construction, when the type is known. -- Andrei
>
> Ugh:
>
> void main() {
> alias TYPE = immutable(ubyte[]);
>
> auto TYPEV2 = cast(immutable)TYPE.init;
> alias TYPE2 = typeof(TYPEV2);
>
> pragma(msg, TYPE);
> pragma(msg, TYPE2);
>
> static if (is(TYPE2 == TYPE)) {
> pragma(msg, "immutable");
> } else {
> pragma(msg, "mutable");
> }
> }
>
> cast() should be clearing away the immutable, but for some reason it is
> not working the way I would expect.
Loosely related: https://issues.dlang.org/show_bug.cgi?id=14401 -- Andrei
More information about the Digitalmars-d
mailing list