Typeinfo.compare and opCmp woes

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Jul 8 07:55:11 PDT 2013


On Sun, Jul 07, 2013 at 10:24:12PM -0700, Jonathan M Davis wrote:
> On Sunday, July 07, 2013 22:13:59 H. S. Teoh wrote:
> > since due to the bug that we can't have both a template and
> > non-template method of the same name
> 
> I believe that Kenji fixed that bug recently.
[...]

Kenji is awesome!! So I just figured out that the reason my previous
attempts didn't work, was because the opCmp that DMD is looking for to
include in the typeinfo must be declared BEFORE all of the other opCmp
overloads, otherwise it won't find it. So adding:

	int opCmp(ref const S s) const { ... }

*before* the templated versions of opCmp solved the problem. It's ugly
but at least it works.

OTOH, this appears to be one of those places where order of declaration
matters. :-(


T

-- 
The fact that anyone still uses AOL shows that even the presence of options doesn't stop some people from picking the pessimal one. - Mike Ellis


More information about the Digitalmars-d mailing list