Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!milano!cadillac!puma!vaughan From: vaughan@puma.cad.mcc.com (Paul Vaughan) Newsgroups: comp.lang.c++ Subject: const and caching Message-ID: <4289@cadillac.CAD.MCC.COM> Date: 27 Nov 89 22:52:09 GMT Sender: news@cadillac.CAD.MCC.COM Lines: 14 Consider the method A::foo(), where foo() conceptually does not change any aspect of the A object, but does cause some information to be cached, so that the next time A::foo() is called, it will return (the same result) sooner. Of course, the compiler won't let me declare A::foo() to be const because it writes to a slot in the A object, and it would clearly not work if this object were stored in ROM. The only solution I can think of is to have both a const version and a non-const version available, where the const version will always be slow. Any comments? Paul Vaughan, MCC CAD Program | ARPA: vaughan@mcc.com | Phone: [512] 338-3639 Box 200195, Austin, TX 78720 | UUCP: ...!cs.utexas.edu!milano!cadillac!vaughan