Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-03-15 15:48:33


We talked about two flavors of remove():

   remove( foobar ); // throws if foobar doesn't exist,
                      // or otherwise can't be deleted.

   remove( foobar, nothrow); // doesn't throw ever?

The problem with the second form is that it makes it look like it will
never throw. If fact, if foobar exists, but can't be deleted (perhaps
because it is read-only, in use, wrong permissions, or any other reason)
then we still want to throw, AFAIK.

I'm thinking what we are really looking for is more like this:

   void remove_if_exists( const string & path )
    { if ( exists( path ) remove( path ); }

Is this analysis correct?

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk