
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@dirkgregorius.de> 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: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Cory Nelson http://www.int64.org