Boost logo

Boost :

From: Damien Fisher (damien_at_[hidden])
Date: 2002-06-06 01:12:31


On Thu, 6 Jun 2002, Eyal Farago wrote:

> The destructor of boost::details::scoped_lock is not virtual, I'm not sure but this looks like a problem.
> I'm not exactly familiar with the 'bind to const reference' rule, but it seems to me that in this case the object returned by make_scope_guard is manipulated through reference to base and therefore destroyed this way. I know that on vc6.5 the correct d'tor is called but I don't know if this is standart behavior.

IIRC this is indeed standard behavior. I believe this issue is covered
in the article below.

>
> Eyal.
>
> -----Original Message-----
> From: Joe Swatosh [mailto:joe-swatosh_at_[hidden]]
> Sent: Thursday, June 06, 2002 3:17 AM
> To: boost_at_[hidden]
> Subject: [boost] Boostifying ScopeGuard
>
>
> Petru Marginean and Andrei Alexandrescu wrote a handy group of classes that will call a function when a "guard" object goes out of scope (unless the "guard" has been "dismissed"), that they documented in a CUJ "C++ Experts Forum" column. The article is available online:
> http://www.cuj.com/experts/1812/alexandr.htm?topic=experts
>
> With their permission, I've attempted to "boostify" this group of classes. I have uploaded these files to the "vault" (together they are fewer than 200 lines so I hope not compressing them isn't too big a deal). The code has been tested with VC6SP5, VC7, and Borland 5.5.
> http://groups.yahoo.com/group/boost/files/scope_guard/scope_guard_test.cpp
> http://groups.yahoo.com/group/boost/files/scope_guard/scope_guard.hpp
>
> I realized that much of the code in the original was for binding arguments to the function to be called and so could be replaced by boost::bind. Other than that I renamed things to be more like the naming conventions on the boost website, and simplified where possible.
>
> I recognize that this is basically a primitive "smart resource" and that smart resources have been discussed a lot lately especially in the context of smart pointers. These classes are just so simple and useful that I want to propose something _now_ to fill the gap. This much too small to be a boost library by itself and I'm not sure where it might fit, so here it is to talk about.
>
> Joe Swatosh [mailto:joe-swatosh_at_[hidden]]
> 3305 Main St. Suite 201
> Vancouver, WA 98663
> 360-737-6654
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk