Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-07-18 14:16:31


BOOST_PP_SEQ_ENUM is failing for me when invoked from another macro;
When the argument is

  (A0)

I get

  BOOST_PP_SEQ_ENUM_2

and when the argument is

  (A0)(A1)

I get

  BOOST_PP_SEQ_ENUM_4

I think what happens is that CW "sees through" the outer set of parens
in

# define BOOST_PP_SEQ_ENUM(seq) BOOST_PP_CAT(BOOST_PP_SEQ_ENUM_, BOOST_PP_SEQ_SIZE(seq)) seq

and pastes seq to itself, yielding a length of 4 instead of 2. Here's
a workaround:

# define BOOST_PP_SEQ_ENUM_I(size,seq) BOOST_PP_CAT(BOOST_PP_SEQ_ENUM_, size) seq
# define BOOST_PP_SEQ_ENUM(seq) BOOST_PARAMETER_SEQ_ENUM_I(BOOST_PP_SEQ_SIZE(seq), seq)

I hope this is useful.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk