Associative arrays in D and default comparators

Walter Bright newshound at digitalmars.com
Thu Sep 7 22:32:02 PDT 2006


Ivan Senji wrote:
> Yes: here is a suggestion: remove opCmp from Object. I think the only 
> reason it is there is that when AAs where first implemented templates 
> weren't where they are now so there was no way to check if an object has 
> opCmp. These days a template version of AAs would be much better, and it 
> would (if I'm not mistaken) remove the need for opCmp to be in Object.

While it'd be fun to offer a templated version of AAs, I feel the core 
capabilities should be available to the user without needing templates. 
This is because many programmers are not comfortable with them.

Can you give an example of a class that could not have a meaningful 
opCmp implementation that one would want to put into an AA?



More information about the Digitalmars-d-bugs mailing list