I have the following boost preprocessor macro to generate a function
extern "C" EXPORT out name(BOOST_PP_SEQ_FOR_EACH_I(PARAMETER_LIST, 0, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)))
This works great unless if __VA_ARGS__
is empty. After some searching I found a way to count the numer of arguments in __VA_ARGS__
using BOOST_PP_VARIADIC_SIZE. After some thinking I wrote this MACRO:
extern "C" EXPORT out name(BOOST_PP_IF(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), BOOST_PP_SEQ_FOR_EACH_I(PARAMETER_LIST, 0, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)), void))
I think this should work, however I keep getting the following warning
warning C4002: too many actual parameters for macro 'BOOST_PP_IIF_1'
Although this is a warning it still seems to break the preprocessor. When passing multiple arguments it will only process the first one. I find this so strange, how will adding this if break everything is such a weird way? I've checked the comma's and brackets hundred times but they seem fine. How can I fix this preprocessor?
http://www.boost.org/doc/libs/1_54_0/libs/preprocessor/doc/ref/if.html
Edit: this regression seems relevant: https://svn.boost.org/trac/boost/ticket/8606