Вопрос

I am testing BOOST_PP_VARIADIC_SIZE as following:

#include <boost/preprocessor.hpp>
#define PORT_HOST A,B
#define PORT_ADDR 1,2,3,4
#define VAR_DATA x, y, z
BOOST_PP_VARIADIC_SIZE(VAR_DATA)

This is what I get after expansion:

BOOST_PP_VARIADIC_SIZE(x, y, z)

But if I do this:

#define SEQ (B)(O)(O)(S)(T)
BOOST_PP_SEQ_ENUM(SEQ) // expands to B, O, O, S, T

After expansion, I get:

B, O, O, S, T

I am using pretty much latest clang on Mac OS. g++ also produces the same results.

I am wondering what is going on here. Why variadic boost preprocessor doesn't expand correctly. I am using boost 1.49.0

Это было полезно?

Решение

Found the answer. In Boost 1.49, in the header file BOOST/Preprorccessor/config.hpp, clang is not being defined to support Variadic marcos. The reason is "not tested".... :(

After enable clang, variadic marco expands as expected.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top