Sign in to follow this  

[Resolved... sorta] Nesting Boost's FOR_EACH macro

This topic is 4780 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey I'm trying to create a macro using Boost's preprocessor library that has nested BOOST_PP_LIST_FOR_EACH's. Something akin to this:
#define MACRO2(r,data,elem) elem
#define MACRO1(r,data,elem) BOOST_PP_LIST_FOR_EACH(MACRO2,NULL,elem)

#define LIST ( (1,(2,(3,BOOST_PP_NIL))), ( (4,(5,(6,BOOST_PP_NIL))), BOOST_PP_NIL ) )

#define MACRO BOOST_PP_LIST_FOR_EACH(MACRO1,NULL,LIST)


But it doesn't work - the first FOR_EACH works fine but the nested one isn't expanded. Any ideas? [UPDATE] I managed to find a solution for the problem by rearranging the order things are done in - basically placing the FOR_EACH directly inside MACRO in place of LIST. [Edited by - Nanoprobe on November 14, 2004 5:03:30 AM]

Share this post


Link to post
Share on other sites

This topic is 4780 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this