This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: try, finally


On Wed, Mar 19, 2008 at 3:09 PM, me22 <me22.ca@gmail.com> wrote:
> On Wed, Mar 19, 2008 at 3:02 PM, Jason Cipriani
>
> <jason.cipriani@gmail.com> wrote:
>
> >  Does std or boost have some kind of "smart pointers" that let me
>  >  define the cleanup actions without having to write too much additional
>  >  code?
>  >
>
>  Yup, boost::shared_ptr (std::shared_ptr, in C++1x) will let you do that.
>
>  boost::shared_ptr<xmlDoc> doc( xmlReadFile(...), xmlFreeDoc );
>  if (!doc) throw something();

Thanks, this is exactly the kind of solution I was looking for.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]