typeof from TypeInfo

Daniel Keep daniel.keep.lists at gmail.com
Sat Mar 20 02:44:32 PDT 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);
> 
> Steve

TypeInfo is a run-time value.  typeof is a Type expression which makes
it a compile-time construct.

You cannot go run-time -> compile-time.



More information about the Digitalmars-d mailing list