Preprocessor library: inrement a macro
Hello, I simply want to increment a macro, like that: #define VARIABLE 7 FunctionA( VARIABLE ); // VARIABLE expands to 7 #define VARIABLE BOOST_PP_INC(VARIABLE) FunctionB( VARIABLE ); // VARIABLE expands to 8 #define VARIABLE BOOST_PP_INC(VARIABLE) FunctionC( VARIABLE ); // VARIABLE expands to 9 #define VARIABLE BOOST_PP_INC(VARIABLE) ... Of course, as I have written it, it does not work. What's the right way? Thanks a lot! Arno P.S. I don't want to iterate. FunctionA/B/C are all different constructs. I simply want to avoid forgetting to adjust all numbers when making a change to the chain of calls.
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Arno Schödl
I simply want to increment a macro, like that:
#define VARIABLE 7 FunctionA( VARIABLE ); // VARIABLE expands to 7 #define VARIABLE BOOST_PP_INC(VARIABLE) FunctionB( VARIABLE ); // VARIABLE expands to 8 #define VARIABLE BOOST_PP_INC(VARIABLE) FunctionC( VARIABLE ); // VARIABLE expands to 9 #define VARIABLE BOOST_PP_INC(VARIABLE) ...
Of course, as I have written it, it does not work. What's the right way?
The closest mechanism in the pp-lib is the slot mechanism. E.g.
#include
participants (2)
-
Arno Schödl
-
Paul Mensonides