enums and std.traits

Timon Gehr timon.gehr at gmx.ch
Sat Aug 4 15:15:02 PDT 2012


On 08/04/2012 11:09 PM, Jonathan M Davis wrote:
> I agree that an enum's base type should not implicitly convert to the enum
> type, since that would mean that you could have an invalid enum value, but I
> see no problem with enums implicitly converted to their base type.
>

Well, there is a problem:

T fun(T)(T arg) if(isSomeString!arg){
     return arg~arg[0];
}

The constraint would be too weak.


More information about the Digitalmars-d mailing list