Boost logo

Boost Users :

From: Delfin Rojas (drojas_at_[hidden])
Date: 2005-01-21 18:14:49


I think this should work for all the cases you mention:

http://www.boost.org/libs/smart_ptr/sp_techniques.html#handle

http://www.boost.org/libs/smart_ptr/sp_techniques.html#on_block_exit

-delfin

> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Aaron W. LaFramboise
> Sent: Friday, January 21, 2005 2:13 PM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] How to automatically release legacy resources?
>
> Mauricio Gomes wrote:
>
> > I would create a class (File or other name) that close() on its
> > destructor.
>
> I do not like this solution, but not because it doesn't work. It works
> just fine, and probably better than the more complicated alternatives
> that I have been thinking of.
>
> The trouble is that its 'difficult.' Writing a class to do this takes a
> small but significant amount of effort. Maintaining code with this
> class be be slightly but significantly more difficult.
>
> In particular, in code specific to a particular problem domain (as
> opposed to in general-purpose libraries), I don't like to see a whole
> lot of code that has nothing to do with that domain, or adds a whole lot
> of structure for very little expressive benefit. This sort of verbosity
> is a problem--I think--and a particular problem for C++. A significant
> criticism of C++ that I have heard is that the implementation of many
> sorts of code requires too structure, so that there is less actual
> expressive code than non-expressive code.
>
>
> Aaron W. LaFramboise
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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