• Advertisement
Sign in to follow this  

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

This topic is 4877 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 ) )


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
Sign in to follow this  

  • Advertisement