"Marshall Clow"
wrote in message news:p0511190fb921ff8971bf@[192.168.16.220]... At 10:02 PM -0700 6/3/02, Duane Murphy wrote:
The canonical example is a file iterator; iterate over the files in a directory. The directory appears to be a container with filenames as the members of the container.
I have gone back to this example several times in the last few years.
I have finally decided that this is a bad idea, because a file system directory is not really a container. The container can be changed outside the currently executing program, and there is no "container-like" semantics to tell the program that the iterators into that container are invalid.
?? Except in some implementations' debug mode, none of the standard containers tell the program when their iterators become invalid either.
Yes, the container's iterators are under your control. You can ensure that the iterators stay valid by not changing the container. (or by making only 'safe' changes). [ Multi-threaded programs are more complicated, but can be solved, too ] You cannot get any such guarantees for a directory. -- -- Marshall Marshall Clow Idio Software mailto:marshall@idio.com My name is Bobba Fett. You killed my father, prepare to die!