Boost logo

Boost :

From: Nicholas Neumann (nick2002_at_[hidden])
Date: 2021-03-05 04:26:43


Peter Dimov wrote:
> If you're going to use a client-supplied callback, the most
straightforward one
> would just return a shared_ptr<FILE> (or the appropriate equivalent).
Then both
> opening and closing are under the callback's control.

That's interesting to think about. A simultaneous pro and con I see is that
the callback now has to deal with how to open and close a file, which was
an implementation detail of the backend before. If you want or need that
level of control, it is useful. But a callback which asks "close the file?"
only has to take a path and return a boolean, leaving most of the concerns
to the backend. Both allow for any caching strategy. Either one works for
me so if the shared_ptr<FILE> approach solves problems for others that the
boolean approach does not, I'd be just as happy with it.


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