2 problems I can't get my head around

Manu turkeyman at gmail.com
Mon Nov 26 09:59:25 PST 2012


On 26 November 2012 19:38, Adam D. Ruppe <destructionator at gmail.com> wrote:

> On Monday, 26 November 2012 at 17:30:46 UTC, Manu wrote:
>
>> Error: variable isProperty cannot be read at compile time
>>
>
> This is easy now that I see the code:
>
>  template isProperty( T )
>> {
>> bool isProperty = false;
>> }
>>
>
>
> That should be enum bool isProperty = false. The enum is important because
> that makes it a compile time value, instead of a runtime variable like
> regular "bool isProperty".
>
> Generally if you want something at compile time, enum is the magic keyword
> to put before an otherwise normal variable declaration.
>
> Fix that in both places you did it... and import std.traits of course, and
> your code compiles.
>
> Not sure if it is right, but it compiles and spits a bunch of output.
>

Ah crap! Yes I know, this is effectively a typo, I've just been staring at
this way too long ;)
It still doesn't work though. Some of that output is wrong, and when I
actually use these in context, there are further problems. But it's getting
there.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121126/69d04e72/attachment.html>


More information about the Digitalmars-d mailing list