is() and const

Andrea Fontana nospam at example.com
Wed Jul 18 02:37:28 PDT 2012


It seems to works (but i use Unqual!T directly)

Thank you :)

Il giorno mer, 18/07/2012 alle 11.13 +0200, bearophile ha scritto:

> Andrea Fontana:
> 
> > const(int) : int  <-- true
> > const(PP) : PP  <-- false
> >
> > Is this behaviour correct?
> 
> I think it's correct, and it's caused by the difference between 
> value types and reference types.
> 
> 
> > And how can I check if T is of a certain class ignoring consts 
> > (and avoiding double checks)?
> 
> There are some different ways to do it, one of them is to use 
> something like (untested):
> 
> is(Unqual!typeof(x) == PP)
> 
> Where Unqual is in Phobos, std.traits.Unqual.
> 
> Bye,
> bearophile


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20120718/331293b4/attachment.html>


More information about the Digitalmars-d-learn mailing list