On Mon, 06 Dec 2010 10:11:30 -0500, so <s...@so.do> wrote:

It doesn't work. obj == obj calls .opEquals(obj, obj), whose signature is:

bool opEquals(Object obj1, Object obj2)

So even if you mark a derived instance's opEquals as const, the derived class is stripped back down to Object before any calls are made.

Memoization and lazy calculations are not as important as being able to compare const or immutable objects.

-Steve

This one is a very serious issue.
Should changing their signatures to:
bool op###(auto ref const Object) const // breaking change but just signature

and addressing "auto ref" enough to fix it?

auto ref doesn't matter, these are classes, they are always ref ;)

All that is needed is to make opEquals const (and its arguments const) as you say.

With a glance to source code, looks like all that is required is just a few lines of change.

It should be relatively painless. Just change the signatures of the base functions, and fix any compile errors.

-Steve

Reply via email to