I am going to use our wonderful Preprocessor library to generate a
metafunction that basically looks like this:
template
int C0, int C1, ..., int Cn
struct max_arity
{
static int const value = Cn 0 ? Cn : ( Cn-1 0 ? Cn-1 :
... ( C1 0 ? C1 : (
- Original Message -
From: Aleksey Gurtovoy [EMAIL PROTECTED]
Hi Aleksey,
I am going to use our wonderful Preprocessor library to generate a
metafunction that basically looks like this:
[...]
I love everything about it except for the (0, (1, (2, (3, (4,
BOOST_PP_NIL) part. I
Paul Mensonides wrote:
#include boost/preprocessor/seq/fold_left.hpp
#include boost/preprocessor/seq/subseq.hpp
#define NUMBERS \
(0)(1)(2)(3)(4)(5)(6)(7)(8)(9) \
(10)(11)(12)(13)(14)(15)(16)(17)(18)(19) \
/* ... */
#define RANGE(first, length) \
BOOST_PP_SEQ_SUBSEQ(
- Original Message -
From: Aleksey Gurtovoy [EMAIL PROTECTED]
#define NUMBERS \
(0)(1)(2)(3)(4)(5)(6)(7)(8)(9) \
(10)(11)(12)(13)(14)(15)(16)(17)(18)(19) \
/* ... */
#define RANGE(first, length) \
BOOST_PP_SEQ_SUBSEQ( NUMBERS, first, length ) \
/**/
- Original Message -
From: Aleksey Gurtovoy [EMAIL PROTECTED]
BOOST_PP_SEQ_FOLD_LEFT(AUX_MAX_ARITY_OP, -1, RANGE(0, 5))
Hmm, it doesn't work on Metrowerks 8.3: the compiler chokes on
preprocessing
[...]
Is it a known failure? It would be nice to have some tests for the SEQ
stuff
Paul Mensonides wrote:
- Original Message -
From: Aleksey Gurtovoy [EMAIL PROTECTED]
#define NUMBERS \
(0)(1)(2)(3)(4)(5)(6)(7)(8)(9) \
(10)(11)(12)(13)(14)(15)(16)(17)(18)(19) \
/* ... */
#define RANGE(first, length) \
BOOST_PP_SEQ_SUBSEQ( NUMBERS,