The BOOST_PP_IDENTITY_N macro expands to its first argument when invoked.

Usage

BOOST_PP_IDENTITY_N(item,n)(n-arguments)

Arguments

item
The result of the expansion.
n
The number of arguments when invoked.

Remarks

This macro is designed to be used with BOOST_PP_IF and BOOST_PP_IIF when only one of the clauses needs to be invoked.

See Also

Requirements

Header:  <boost/preprocessor/facilities/identity.hpp>

Sample Code

#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/facilities/identity.hpp>

#define MACRO_CAT(y,z) y ## z
#define MACRO(n) BOOST_PP_IF(n, BOOST_PP_IDENTITY_N(x,2), MACRO_CAT)(a,b)

MACRO(0) // expands to ab
MACRO(1) // expands to x

© Copyright Edward Diener 2015

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)