D: Unexpected output when using a delegate and EnumMembers

Timon Gehr timon.gehr at gmx.ch
Tue Jun 19 08:32:49 PDT 2012


On 06/19/2012 05:08 PM, Artur Skawina wrote:
>
> Yes, it can be surprising, but I'm not convinced it's actually wrong
> behavior (the bug is http://d.puremagic.com/issues/show_bug.cgi?id=2043)
>

It is not this bug. (And what is listed there is clearly wrong
behaviour, because it can be used to break the type system.)

> Just do this:
>
>     size_t c = count!(function(x, e) { return x.e == e;} )(source, e);
>
> and it will work. [1]
>
> artur
>
> [1] I don't do that new kinky lambda syntax, sorry. ;)

Your embarrassment about this issue is justifiable.


More information about the Digitalmars-d-learn mailing list