Understanding isInfinite(Range)

Pelle pelle.mansson at gmail.com
Mon Sep 6 13:06:50 PDT 2010


On 09/06/2010 08:53 PM, Philippe Sigaud wrote:
> On Mon, Sep 6, 2010 at 18:47, Pelle <pelle.mansson at gmail.com
> <mailto:pelle.mansson at gmail.com>> wrote:
>
>     On 09/04/2010 02:11 PM, Simen kjaeraas wrote:
>
>             Is there a way you could write an isStatic(expr) template? Using
>
>
>         template isStatic( alias T ) {
>         enum isStatic = is( char[1+T] );
>         }
>
>         unittest {
>         int n = 3;
>         assert( !isStatic!n );
>         assert( isStatic!1 );
>         enum r = 5;
>         assert( isStatic!r );
>         }
>
>
>     enum s = "Hello";
>
>     assert (isStatic!s);
>
>     Gonna need more work than that.
>
>
> Why? That's exactly the behavior we want, or so it seems to me.
>
>

Sorry if I was unclear, that assert fails. Due to that you cannot add an 
integer and a string, not not that the string isn't static. It's an 
enum, so it definitely is static.


More information about the Digitalmars-d-learn mailing list