Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Can't create TreeMap!(double, myclass)()

Moderators: kris

Posted: 03/11/07 17:20:34

It looks like the key in TreeMap?! is required to be able to be null. This means you can't create a map with a numeric key! I got it to compile by creating a container for the double:

class TheKey? {

this(double aD) {

mD = aD;


bool opCmp(double aD) { return mD < aD; }

double mD;


But this is a silly thing to have to do; should I file a ticket on this?

HashMap? has the same problem, and also requires some kind of IReader stuff on the 'myclass' part. Maybe this read/write stuff should be in a HashMap? descendant, so you aren't required to have your class be capable of IReader or whatever.

Author Message

Posted: 03/11/07 18:35:41

The container's code is based on an original Java implementation, so there still may be some lingering bias towards boxed primitives. Thanks for the info. Barring technical obstacles, this will be fixed prior to 1.0.

Posted: 03/12/07 19:05:41

fixed; thank-you, Ansible

Posted: 03/12/07 21:26:25

wow, you guys are fast! thx for the fix.