[Boost.Preprocessor] Why BOOST_PP_SEQ_CAT with a sequence of comma separated pair is a missuse ?
Hello,
I tried to use the BOOST_PP_SEQ_CAT with a sequence of parenthesized
comma-separated pair of token. It works fine with visual 2010 but fails
with gcc. I first think that there were a problem in the specific gcc
implementation part. That's why I opened the issue 9633 :
https://svn.boost.org/trac/boost/ticket/9633
But, it has recently been closed for invalidity, the corrector telling
that it is not a valid use.
I have not read the entire help of the PP library but as far as I
understand the sequence definition given in A.4.5.1.
(http://www.boostpro.com/mplbook/preprocessor.html) as "any string of
nonempty parenthesized /macro arguments/." and the definition of macro
arguments in A.2.3, I fail to see why the sequence could be incorrect.
Specially when I read the end of the paragraph :
"
It /is/ possible to pass either string of tokens above as part of a
single macro argument, provided it is parenthesized:
FOO(*(*std::pair
AMDG On 03/11/2014 02:46 AM, Albert wrote:
I tried to use the BOOST_PP_SEQ_CAT with a sequence of parenthesized comma-separated pair of token. It works fine with visual 2010 but fails with gcc. I first think that there were a problem in the specific gcc implementation part. That's why I opened the issue 9633 : https://svn.boost.org/trac/boost/ticket/9633 But, it has recently been closed for invalidity, the corrector telling that it is not a valid use.
<snip> So my questions are : => why the code I proposed is invalid ?
You are correct that this is a valid sequence. The problem is that the elements cannot be concatenated. BOOST_PP_CAT(('a', 1), ('b', 2)) should also fail with a similar error.
=> Is the workaround proposed with BOOST_PP_SEQ_FOR_EACH is also a missused and may fail according to evolutions of the library ?
Your workaround does not use ## and is therefore perfectly fine. In Christ, Steven Watanabe
participants (2)
-
Albert
-
Steven Watanabe