Different typeof syntax

bearophile bearophileHUGS at lycos.com
Sun May 16 13:43:34 PDT 2010


Do you know if it's possible to replace  typeof(f1)  with  f1.typeof  in D (for symmetry with sizeof too)?

import std.stdio: writeln;
struct Foo {
    int x;
}
void main() {
    Foo f1;
    int fsize = f1.sizeof; // OK
    alias typeof(f1) T1;   // OK
    alias f1.typeof T2;    // ERR
}


[What I'd like is this, but this is for another thread:
Type T2 = f1.typeof;
]

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list