digitalmars.D - typeof from TypeInfo
- Steve Teale (13/13) Mar 20 2010 If I have an int say, I can declare another of the same
- Daniel Keep (4/24) Mar 20 2010 TypeInfo is a run-time value. typeof is a Type expression which makes
If I have an int say, I can declare another of the same int a; typeof(a) b; If I have a TypeInfo instance ti, it would be nice to be able to do something similar, either special-case it, or have a property or method on Typeinfo. typeof(ti) x; ti.typeof y; It's probably already there and I just haven't found it/worked it out yet. Something of this sort would make the code in typesafe varadic functions much more succinct _arguments[i].typeof a = va_arg!(arguments[i].typeof)(args); Steve
Mar 20 2010
Steve Teale wrote:If I have an int say, I can declare another of the same int a; typeof(a) b; If I have a TypeInfo instance ti, it would be nice to be able to do something similar, either special-case it, or have a property or method on Typeinfo. typeof(ti) x; ti.typeof y; It's probably already there and I just haven't found it/worked it out yet. Something of this sort would make the code in typesafe varadic functions much more succinct _arguments[i].typeof a = va_arg!(arguments[i].typeof)(args); SteveTypeInfo is a run-time value. typeof is a Type expression which makes it a compile-time construct. You cannot go run-time -> compile-time.
Mar 20 2010