All the BOOST_PP functions only work on integer constants. I want to write macros, where the same interface can be used for both constants and variables, and only call the BOOST_PP if the argument is a constant, and use runtime code if it is a variable. For example,
#define TWICE(n) BOOST_PP_IF( _IS_CONSTANT(n), \
BOOST_PP_MUL(n,2), \
( (n) * 2) )
For more details, you can also see the original question here :
http://stackoverflow.com/questions/3884489/mixing-variables-and-integer-constants-in-the-boost-preprocessor
Is there a way to do so? The C preprocessor knows whether something is a constant, so we should be able to do this somehow. Or should I suggest this as a feature request for the Boost Preprocessor library?
Thanks!