On Tue, Dec 10, 2002 at 08:00:03PM +0000, John Levon wrote: > > > > "short" makes me go: "Hu! Why? Anything special going on here?" > > why not save some memory ?
The saving is negligible (compared to the memory already used by the map, and the memory used to hold the font). > > And why cannot these be left const? > > Because we have to modify the std::map You can declare the map mutable. PS: A possible optimization is to hold in addition to the map an array that stores the widths for the unicode chars 32-127 (the most common chars). Of course, I don't know if this will give any speedup, or if it worths the extra code.