On Tuesday, 19 September 2017 at 13:18:04 UTC, drug wrote:
19.09.2017 15:38, Steven Schveighoffer пишет:
On 9/19/17 8:01 AM, drug wrote:
I iterate over struct members and check against equality depending on member type. is there more simple/cleaner/better way to achieve this functionality? Especially without string mixins?

Why not just use tupleof directly instead of having to find the member name and using mixins?

-Steve

Hmm, I'm sure I had tried it before and failed, but now I've managed to do so and it's really simpler

Could be a bit simpler than that, depending on your needs:

bool opEquals(Object other) const nothrow @nogc
{
    auto f = cast(typeof(this)) other;
    if (f is null) return false;
    return this.tupleof == other.tupleof;
}

Reply via email to