Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2008-07-01 09:54:42

The remove(p) function is currently specified to return a bool with a
value of exist(p) before the post-condition is established. The
post-condition is !exists(p).

The original thought in providing this was that the return value might
be useful and would cost nothing.

It turns out that providing this return value does have several costs:

* A call to exists() could be omitted if the actual system removal call
succeeds. exists() is surprisingly expensive on some operating systems.

* It makes the remove() function less reliable in that it introduces a
potential race condition.

* It makes flow of control more complex (and thus harder to test) for
some implementations.

Thus I'd like to change the return to void. Although that will break
some code, the breakage will result in a noisy compile-time error that
is easy to fix by inserting a call to exits() before the call to remove().



PS: This was precipitated by ticket #1972, but doesn't affect the
resolution of the remove() issue it raises. That will be fixed for
1.36.0 regardless.

Boost list run by bdawes at, gregod at, cpdaniel at, john at