https://issues.dlang.org/show_bug.cgi?id=8681

Marco Leise <marco.le...@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marco.le...@gmx.de

--- Comment #2 from Marco Leise <marco.le...@gmx.de> ---
(In reply to hsteoh from comment #1)
What works with the type system is to isolate the fields from C that define its
equality:

struct ImmutableCPart
{
    int x;

    size_t toHash() const {
        return typeid(int).getHash(x);
    }
    bool opEquals(const C c) const {
        return x == c.x;
    }
}

class C {
    immutable ImmutableCPart x;
    int y, z;

    this() { ... /* initialize x */ }
}

C[ImmutableCPart] lookup;

--

Reply via email to