
16 Nov
2009
16 Nov
'09
4:07 p.m.
2009/11/16 Surya Kiran Gullapalli
Definition of PP_NARG is here:
http://groups.google.com/group/comp.std.c/browse_thread/thread/77ee8c8f92e4a...
This does not seems to be working, I keep getting the error C4003, not enough actual parameters for macro 'PP_ARG_N'
GCC says, PP_ARG_N expects 65 args, where as it is getting only 3. I'm kinda lost here .
Hm... that's because both branches of BOOST_PP_IF always get evaluated. We need to evaluate only one of them. #define FOO_ARGS(...) \ BOOST_PP_IF( \ BOOST_PP_EQUAL(PP_NARG(__VA_ARGS__), 2), \ (__VA_ARGS__, 0), \ (__VA_ARGS__)) #define FOO(...) BOOST_PP_EXPAND(FOO_IMPL FOO_ARGS(__VA_ARGS__)) I'm attaching a complete solution. Roman Perepelitsa.