How to get the base type of a typedef

Daniel Keep daniel.keep.lists at gmail.com
Fri May 1 06:44:05 PDT 2009



bearophile wrote:
> MLT:
>> Is there a way to get the base type of location?
> 
> See the BaseTypedef() template in the "templates" module of my dlibs (they are for Phobos):
> http://www.fantascienza.net/leonardo/so/libs_d.zip
> 
> Bye,
> bearophile

It's probably something along the lines of:

template BaseTypedef(T)
{
    static if( is( T U == typedef ) )
        alias U BaseTypedef;
    else
        alias T BaseTypedef;
}

  -- Daniel


More information about the Digitalmars-d-learn mailing list