https://issues.dlang.org/show_bug.cgi?id=9065

Rory <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #52 from Rory <[email protected]> ---
(In reply to Manu from comment #11)

> template isEnum( T )
> {
>       enum isEnum = is( T == enum );
> }
> 
> // test if something is a variable; has a value, has an address
> template isVariable( alias T )
> {
>       enum isVariable = !is( T ) && is( typeof( T ) ) // if it is not a type, 
> and
> does have a type, it starts to look like a variable
>               && !isFunction!T                                                
>         // reject function definitions, they can't be
> assigned to
>               && !isEnum!T                                                    
>         // reject enum's
>               && !is( typeof( T ) == void );                          // 
> reject modules, which appear as a
> variable of type 'void'
> }


Thanks for this, I used this in Adam's jsvar to get a more meaningful
conversion from enum to bool which was initially causing the module to not be
valid because isIntegral!(some enum) == true.

--

Reply via email to