If I have to do it manually it pretty much defeats the purpose of using it in the first place. I want it to be automated.

On Dec 20, 2007 4:44 PM, Andry <andry@inbox.ru > wrote:
Hello Robert,

Friday, December 21, 2007, 12:51:03 AM, you wrote:

RD> I'm currently compiling my code in Visual Studio 2005. Below
RD> is the code that utilizes BOOST_PP_COUNTER. Note that the goal
RD> here is to increment the counter 1 time each time the
RD> CHECK_MATCH_AND_RETURN macro is used. This allows me to make sure
RD> that I've got one macro call per enumeration member. The problem
RD> I'm having is that I'm getting page after page of compiler error
RD> and as far as I can tell I'm using the counter system as it was
RD> shown in the code examples. Below I've also listed some of the
RD> compiler errors I'm getting:

RD> //=========================================================================================
RD> CameraAction StringToCameraAction( const std::string& str )
RD>  {
RD> // I'm using a macro here because I need the stringizing preprocessor operator (#)
RD> // to make the conditionals more manageable. By using
RD> this macro, I never have to explicitly
RD> // update the string comparison itself if the enumeration names ever change.
RD> #define CHECK_MATCH_AND_RETURN( action ) if( str ==
RD> #action ) { return action; } #include BOOST_PP_UPDATE_COUNTER()

RD>   CHECK_MATCH_AND_RETURN( ROTATE_LEFT )
RD> CHECK_MATCH_AND_RETURN( ROTATE_RIGHT )
You can't do that cause # is invalid preprocessor token. Instead you
should explicitly write include lines:

#define CHECK_MATCH_AND_RETURN( action ) if( str == #action ) { return action; }
CHECK_MATCH_AND_RETURN( ROTATE_LEFT )
#include BOOST_PP_UPDATE_COUNTER()
CHECK_MATCH_AND_RETURN( ROTATE_RIGHT )
#include BOOST_PP_UPDATE_COUNTER()

etc.

--
Best regards,
 Andry                            mailto: andry@inbox.ru

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users