The BOOST_PP_COMMA_IF macro conditionally expands to a comma.

Usage

BOOST_PP_COMMA_IF(cond)

Arguments

cond
The condition that determines if a the macro expands to a comma or nothing.  Valid values range from 0 to BOOST_PP_LIMIT_MAG.

Remarks

If cond expands to 0, this macro expands to nothing.  Otherwise, it expands to a comma.
The preprocessor interprets commas as argument separators in macro invocations.  Because of this, commas require special handling.

See Also

Requirements

Header:  <boost/preprocessor/punctuation/comma_if.hpp>

Sample Code

#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>

#define MACRO(z, n, text) BOOST_PP_COMMA_IF(n) text

BOOST_PP_REPEAT(3, MACRO, class) // expands to class, class, class

© 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)