Boost logo

Boost :

From: Cory Nelson (phrosty_at_[hidden])
Date: 2004-12-28 17:56:16

Using a handle alone won't work, but if you wrap them in objects (that
destroy them on a destructor) and use those in the smart pointers, it
should work fine.

On Tue, 28 Dec 2004 22:16:05 +0100, Dirk Gregorius
<dirk_at_[hidden]> wrote:
> Dear group,
> is it possible to use smart_ptr with handles ( e.g. HWND, HBRUSH, HDC,
> etc )? Wouldn't it be quite convenient to have something like a scoped
> or shared resource? The idea came when I looked my OpenGL initialisation
> code, where I have to free the resource explictly every time an error
> occurs, which make the code somehow a little bit more difficult to read
> and I though that it would be nice to have some kind of RAII mechanism
> here.
> Regards,
> -Dirk
> _______________________________________________
> Unsubscribe & other changes:

Cory Nelson

Boost list run by bdawes at, gregod at, cpdaniel at, john at