Boost logo

Boost Users :

Subject: Re: [Boost-users] [shared_ptr] Is there an interface to set the ptr a shared_ptr holds
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2008-12-28 23:25:04


On Sun, Dec 28, 2008 at 23:04, Max <loadcom_at_[hidden]> wrote:
>
> I'm using this technique for stream:
>
> std::ofstream outstream(strPath);
> boost::shared_ptr<std::ofstream> os_auto_closer(&outstream,
> boost::bind(&std::ofstream::close, _1));
>

You're being a bit more careful than you need to there; file streams
call close on destruction for you. (Well, the filebuf does
[27.8.1.2].)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net