Traits

Jonathan M Davis jmdavisProg at gmx.com
Fri Oct 11 12:05:26 PDT 2013


On Friday, October 11, 2013 15:34:28 Jacob Carlborg wrote:
> On 2013-10-11 11:49, luminousone wrote:
> > Is is just the typeid call that makes it unable to be ran at compile
> > time or is their something else wrong in their?,
> > 
> > Would a string compare with type.classInfo.name fix that, or is their
> > not a tool yet in place for that?
> 
> Hmm, it may actually be possible to run this at compile time. I don't
> remember. I was thinking that "typeid" doesn't work at compile time, but
> I might be wrong.

If typeid works at compile time, it's only because you're using CTFE. It 
returns the type of the instance when the code runs, not statically. So, it's 
intended as a runtime check, not a compile time check.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list