CT-String as a Symbol

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 15 15:56:11 PDT 2015


On 4/15/15 6:42 PM, "Nordlöw" wrote:
> On Wednesday, 15 April 2015 at 20:12:27 UTC, Ali Çehreli wrote:
>> Ali
>
> I cracked it:
>
> Reason: I hade a failing unittest using it as
>
>      auto xs = x.indexedBy!"I";
>
> which I changed to
>
>      auto xs = x.indexedBy!"Ix";
>
> For some reason the mixin magic becomes confused when I equals "I".
>
> Do you have any clues as to why?
>
> Should we restrict IndexedBy to not allow I to equal "I"?
>
> :)
>
> Thx anyway.


Hm.. from that link you sent, look up a bit, you see this interesting 
tidbit:

struct IndexedBy(R, string I_ = "Index") if (isArray!R && I_ != "I_") // 
prevent strange bug from occurring

That comment seems to be similar to what you are talking about...

Later, there's this:

auto indexedBy(string I, R)(R range) if (isArray!R && I != "I_") // 
prevent strange bug from occurring

Should that be change to "string I_" also?

-Steve


More information about the Digitalmars-d-learn mailing list