
On Dec 11, 2012, at 10:19 AM, Nat Linden wrote:
In fact, when I change the definition of the intercept() macro below to:
#define intercept(FIRST, ARGS...) \ targetfunc(transform(FIRST) \ , boost::lexical_caststd::string(BOOST_PP_VARIADIC_SIZE(ARGS)))
I see that BOOST_PP_VARIADIC_SIZE() expands to 1 for intercept("first") as well as for intercept("first", "second").
Is it possible to achieve what I want with my present suite of compilers? Is there some workaround we could use until (at some point in the indefinite future) we've upgraded all our compilers so that even the oldest of them supports variadic functions?
Perhaps something like the following will do what you need? #define intercept(ARGS...) \ BOOST_PP_IIF( \ BOOST_PP_EQUAL(1, BOOST_PP_VARIADIC_SIZE(ARGS)), \ intercept_1, \ intercept_many)(ARGS) where the definitions of intercept_1 and intercept_many should be obvious.