Sasha Sewerow Sasha Sewerow - 2 months ago 17
C++ Question

define BOOST_PP_NODE_13(p) BOOST_PP_IIF(p##(13), 13, 14)

boost
auto_rec.hpp

What does mean p##(13) here:
define BOOST_PP_NODE_13(p) BOOST_PP_IIF(p##(13), 13, 14)

In what it translates?

Answer

The '##' preprocessing operator is used to do concatenation. See Macros. What it does is take tokens from both side of the operator and produce a single token with them.

Here's a classic usage:

#define foo(x, y) x ## y

foo(aa, bb) // expands to 'aabb'

In your case, there is no use to ## since p and (13) don't need to be concatenated to expand into a valid expression. It's interesting to see that ## disappeared in newest versions of boost.

Moreover, it seems clang doesn't like ## with parenthesis as it tries to paste 'p(' as an invalid token on its own, which result in a compiler error.

Comments