enums and std.traits

Christophe Travert travert at phare.normalesup.org
Sun Aug 5 05:38:56 PDT 2012


Jonathan M Davis , dans le message (digitalmars.D:174267), a écrit :
> On Saturday, August 04, 2012 15:22:34 Jonathan M Davis wrote:
>> On Sunday, August 05, 2012 00:15:02 Timon Gehr wrote:
>> > T fun(T)(T arg) if(isSomeString!arg){
>> > 
>> >      return arg~arg[0];
>> > 
>> > }

IMO, the behavior should be this: when trying to call the template with 
a argument that is an enum type based on string, the compiler should try 
to instanciate the template for this enum type, and isSomeString should 
fail. Then, the the compiler will try to instanciate the template for 
strings, which works. Thus, the template is called with a string 
argument, which is the enum converted to a string. 



More information about the Digitalmars-d mailing list