How to get the base type of a typedef

MLT none at anone.com
Fri May 1 05:57:59 PDT 2009


Another question about typedef...

I am using 
typedef long location ;

Now I would like to use tango.math.random.Random. But I am having problems with
calling r.uniformR( hi ) when r is a random genarator, and hi is of type location.
I need to call 
r.uniform!(long)( cast(long)(hi) ) ;

This is ugly, and will work only as long as location remains long. If I decide to change location to 'int', I'll have to go and edit all of these casts.
Is there a better way to do this?
Is there a way to get the base type of location? Something like 
typeof(hi), but that returns 'long' when location is long, and 'int' when int?

thanks!


More information about the Digitalmars-d-learn mailing list