Boost logo

Boost :

Subject: Re: [boost] [mpl] is_macro_called
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2010-04-05 20:44:16


> Lorenzo Caminiti wrote:
> > Is there a way I can do this without using #instructions programmed
> > outside the macro definition?
>
> As I said, I don't see how to do it in pure C++. But if we go away from
> pure C++ macro, if you use a code generator / custom preprocessor
> (modifying boost.wave?), it seems quite feasable, and in a very
> portable manner. Personnaly I think a code generator would do the
> trick without difficulties (use boost.spirit to roll it quick!).
>
> Eg :
> struct X
> {
> TRACK(NameOfTheMacroToTrack)
>
> fn()
> {
> NameOfTheMacroToTrack(X,Y,Z))
> }
>
> TRACKEND(NameOfTheMacroToTrack)
> };
>
> Seems ok, isn't it? I think with only the first TRACK it is even
> possible to do it easily. - Be sure to ignore comments thought -.

FWIW, Wave allows to add your own #pragma directives easily (as long as they
follow the format

   #pragma wave option[(values)]

where [...] means 'optional'. See libs/wave/samples/preprocess_pragma_output
for an (unrelated) example showing how to define your own #pragma.

Regards Hartmut

---------------
Meet me at BoostCon
www.boostcon.com


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