Boost logo

Boost :

Subject: Re: [boost] [scope_exit] Boost.ScopeExit capturing 'this'
From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2009-05-08 10:21:35

<adam.butcher <at>> writes:
> > It should pan out okay -- it is pretty rude to make 'this(...)' a
> > macro, though since C++ doesn't allow that syntax (that I'm aware
> > of) it should be innocuous and will still generate an appropriate
> > error if the user did, in error, use this(...).

I'm not an expert in a preprocessor but if we assume this(arg) macro is ok,
then do(arg) must be ok as well:

#include <boost/preprocessor/cat.hpp>
#include <boost/scope_exit.hpp>

#define do(when) BOOST_PP_CAT(BOOST_AUX_SCOPE_EXIT_,when)()

int main()
    int i = 0;
  } do(end); // or do(ne) ?

Gcc 3.4 compiles this code.

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