Boost logo

Boost :

From: Yao Zhen (yaozhen_at_[hidden])
Date: 2005-10-10 08:55:26

I am aware that variadic macros are not in the
current C++ standard. However, it is declared that
"the C++ standardization committee is likely to
adopt C99's preprocessor extensions for the next
version of the C++ standard." So here is a
question about it.

I have though that with the help of variadic
macros, it would be nolonger necessary for us to
povide size of preprocessor tuples manually. For
instance, in fact it is easy to implement the
BOOST_PP_TUPLE_ELEM macro more clearly as:

#define TUPLE_ELEM(i, tuple) TUPLE_ELEM_ ## i tuple

#define TUPLE_ELEM_0(a0, ...) a0
#define TUPLE_ELEM_1(a0, a1, ...) a1
#define TUPLE_ELEM_2(a0, a1, a2, ...) a2
#define TUPLE_ELEM_3(a0, a1, a2, a3, ...) a3

However, I failed to think out a way to implement
TUPLE_SIZE. Is there any way to do this? If the
answer is yes, it will be possible to eliminate
all the manually specified size argument of all
tuple manipulation macros. That would be a great
news for preprocessor metaprogramming.

Best regards,


USTC Alumni Email System 

Boost list run by bdawes at, gregod at, cpdaniel at, john at