Sean Kelly wrote: > I've found this invaluable at times. And it's actually supported by C++ > containers. It's a bad idea, as it can screw up optimization. For example, if you are using a change-and-swap method of updating a collection, the collection cached by the foreach may get trashed.