enums and std.traits
Christophe Travert
travert at phare.normalesup.org
Sun Aug 5 04:08:55 PDT 2012
Andrej Mitrovic , dans le message (digitalmars.D:174259), a écrit :
> On 8/4/12, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
>> snip
>
> I agree with you. isSomeString!T predicate failing maybe isn't as
> serious as "!isSomeString!T" passing and ending up with wrong results.
> At the very least this should have been discussed about before the
> change.
>
> And why should a template care whether what's passed is an enum or
> not? This complicates code by having to write multiple constraints or
> multiple templates just to handle enums as a special case.
Someone might want to specialize a template for some kinds of enum. I
think the right approach is to try to instanciate a template with the
enum type, and, on failure, to try to instanciate the template based on
the underlying type. The same as fun(foo) try to call foo with the foo
type first, then with something foo implicitely cast to.
--
Christophe
More information about the Digitalmars-d
mailing list