
13 Jun
2005
13 Jun
'05
9:53 p.m.
"Peter Dimov" <pdimov@mmltd.net> wrote in message news:005901c57053$c77160e0$6401a8c0@pdimov2...
Beman Dawes wrote:
The "too similar" problem with overloading predicate functions on directory_iterator is that two very similar calls have different behavior: if ( is_directory( *itr ) ) // uses current status
if ( is_directory( itr ) ) // uses cached status, which may be very stale
That looks like a race-condition trap for unwary users.
I could argue that the second form is less "trappy" for unwary users, actually, because all is_directory( itr ) calls will always yield the same value (and exists(itr) will never yield false for an enumerated item).
Yes. I'm probably worrying too much. --Beman