Boost logo

Boost :

From: Emil Dotchevski (emil_at_[hidden])
Date: 2007-11-02 18:11:05


> > //will crash if fread returns 0
> > shared_ptr<FILE> foo(fread("foo.txt","r"),fclose);
>
> I don't think shared_ptr is designed to work on things like a FILE*. One
> uses filestream or writes a simple class wrapping up the FILE*.

In fact the ability to wrap handles such as FILE directly is one of
the great features of shared_ptr. Why would I write a simple class
wrapping up the FILE * if shared_ptr<FILE> works just as well?

-- 
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode

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