tst7.d(6): Error: cannot implicitly convert expression `e in this.members` of type `bool*` to `bool` tst7.d(15): Error: template instance `tst7.Foo!uint` error instantiating

I'm getting this for this bit of source (trimmed from the bigger code). I switched to this.members.get(e, false) and that works fine, but I'm still curious:

struct Foo(T) {
    bool[T] members;

    bool
    has(T e) {
        return (e in this.members);
    }
}

void
main()
{
    import std.stdio : writeln;

    auto t = Foo!uint();
    writeln(t.has(123));
}
  • "in" operator gives... Andy Valencia via Digitalmars-d-learn

Reply via email to