On Monday 04 November 2002 11:06 am, Andre Poenitz wrote: > On Sat, Nov 02, 2002 at 12:28:38PM +0100, Lars Gullik Bjønnes wrote: > > | I wonder a bit why you suddenly want to make things more visible than > > | they need to be. This does not look like your usual quest... > > > > It not making things visible, it is more not making things > > invisible... > > > > And if caching like this is needed, it should most likely be pushed > > out into a wrapper class. > > It is local caching in a function for the very well defined purposes > of making that function faster [Probably not needed in this case, but we > are talking about principles]. This is an implementation detail which does > not even have to be documented (except for the loss of re-entrance) let > alone to show up in the class interface or in the class structure...
All the above discussion is very interesting but, for this particular case, I felt that caching was excessive and just removed it. I also moved the method out of the class itself and into namespace front as that too seemed more sensible. Perhaps you two could now debate the merits of that particular change ;-) Angus namespace frnt { namespace { char const * const bb_units[] = { "bp", "cm", "mm", "in" }; size_t const bb_size = sizeof(bb_units) / sizeof(char *); } vector<string> const getBBUnits() { return vector<string>(bb_units, bb_units+bb_size); } } // namespace frnt