Bruno Martinez wrote:
I also found http://lists.boost.org/Archives/boost/2009/03/149540.php which includes a patch to support zero arguments, but it wasn't ever merged. It seems scope exit is abandoned.
Not abandoned but carefully looked after. Scroll down the post you're refering to to this line:
#define this(x) (this(x))
Check the code in http://lists.boost.org/Archives/boost/2009/05/151353.php Do we want to go that far? Also, there are some limitations (a) "this" must be first in a capture list and (b) there is no way you can use "this" inside a body if you use C++03 compiler. So, rather than raising a learning curve for no clear benefit, I prefer being explicit and write: YourClass *this_ = this; BOOST_SCOPE_EXIT((this_)... or YourClass& self = *this; BOOST_SCOPE_EXIT((self)... Alex