-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I replied your question on stackoverflow. IMHO this is not a role for
cpp. Let the compiler take care of optimization here.
On Fri, 8 Oct 2010 12:04:30 -0400
Z S
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-cons...
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!
- -- Bryce Lelbach aka wash http://groups.google.com/group/ariel_devel -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkyvcw0ACgkQO/fqqIuE2t6ywgCcDa7FzHr/6lHZOzaetogrhTTC MzoAoO/MwDqzqgbwO2i0Rk8LUoEvMd7+ =0PgS -----END PGP SIGNATURE-----