I was wondering if you ever considered adding a hash function to the «value types» of juce?
My reasons for suggesting this is, as you may already have guessed, related to my PILS language and its data model, but I think it might very well be useful to C++ programmers in general.
One might want to analyse images using a hash table for the colours, or perhaps optimise complex text rendering tasks by some scheme that implies hashing of fonts, just to mention a few possibilities.
(The Colour class, obviously, is rather trivial to hash, but having a named hash function would still be nice when working with hash table templates.)
The String, Typeface and a few File related classes already have an int hashCode() function, so I suggest to define it for a larger set of classes, generally those with copy constructor and == and perhaps = operators, and no virtuals.
This wouldn’t need to be done by hand. I have PILS code that parses the juce headers, and I’ve written apps that do GUI-controlled operations on VB6 forms, so I think I could, without too much pain, write an app that analyses the headers, shows a checkable list of classes deemed to be candidates for hashability, and show the code changes in a preview as you walk the list (this is the sort of stuff I use the caret-scrolling TextEditor for). An implementation might also be generated, based on the fields of the class - but this might need a bit of hand-editing.
If you’re interested (or perhaps just curious to watch your beautiful code being molested by the evil jucePILS chimera), you could write a hint or two about how the hash functions should look, and I’ll give it a try. (You would have to run the app on Windows XP or similar, I haven’t done a linux jucePILS yet.)
