
At 8:35 AM +0000 3/10/09, adam.butcher@selex-comms.com wrote:
The enhancement allows capturing of 'this' in the BOOST_SCOPE_EXIT capture sequence allowing access to any class members within the body.
FWIW I ran into this problem almost immediate upon starting to use BOOST_SCOPE_EXIT, and it seems to be a common situation in my usage.
Member access for the enclosing class can be performed with the syntax:
(*this) -- convertible to enclosing 'this' (**this) -- enclosing 'this' (*this)->member -- accesses member 'member' of enclosing 'this'
This syntax is perhaps controversial though I think both Alex and myself are reasonably happy with it. Alternatives suggested were 'this_', 'this_()', 'enclosing_this', 'enclosing_this()', 'enclosing', 'enclosing()', 'self' and 'self()'.
Any access syntax that doesn't have the form of a variable name will go right back to the original problem if one has a scope exit in the body of another scope exit. I've not yet needed to do something like that with BOOST_SCOPE_EXIT, but I know that I've more than once written a try/finally block that was in the finally clause of another try/finally block (in other languages, obviously).