Sign in to follow this  
Nanoprobe

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

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

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