Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Preprocessor: expansion stops, result is further expandable
From: Daniel James (dnljms_at_[hidden])
Date: 2011-06-19 12:45:00


On 19 June 2011 01:37, Roman Neuhauser <neuhauser_at_[hidden]> wrote:
> Why doesn't DAPHP_REGISTER_CLASSES expand all the way as
> DAPHP_REGISTER_CLASS does?  Please enlighten me.

C macros can't be called recursively. Boost.Preprocessor uses a clever
technique to get round that for some macros, but it doesn't seem to do
it for BOOST_PP_SEQ_FOR_EACH, I'm not sure why, it might be too
expensive to do for every macro.

I think that one thing you can do (and this is pretty crummy) is to
use BOOST_PP_SEQ_FOR_EACH_I for one of the calls and just ignore the
index. Or alternatively you can use a macro that supports recursion, I
think BOOST_PP_SEQ_FOLD_LEFT, BOOST_PP_SEQ_FOLD_RIGHT and BOOST_PP_FOR
are possibilities.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net