The BOOST_PP_APPLY macro abstracts the difference between an argument and nothing.

Usage

BOOST_PP_APPLY(x)

Arguments

x
The abstracted argument.  This argument must be either BOOST_PP_NIL or a tuple with one element--such as (arg) or ((a, b)).

Remarks

If x is BOOST_PP_NIL, this macro expands to nothing.  If x is a one element tuple, it expands to the contents of that tuple.

See Also

Requirements

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

Sample Code

#include <boost/preprocessor/facilities/apply.hpp>
#include <boost/preprocessor/tuple/elem.hpp>

#define CV(i) \
   BOOST_PP_APPLY( \
      BOOST_PP_TUPLE_ELEM( \
         4, i, \
         (BOOST_PP_NIL, (const), (volatile), (const volatile)) \
      ) \
   ) \
   /**/

CV(0) // expands to nothing
CV(1) // expands to const

© Copyright Housemarque Oy 2002
© Copyright Paul Mensonides 2002

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)