The BOOST_PP_LPAREN_IF macro conditionally expands to a left parenthesis.

Usage

BOOST_PP_LPAREN_IF(cond)

Arguments

cond
The condition that determines if a the macro expands to a left parenthesis 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 left parenthesis.
The preprocessor interprets parentheses as delimiters in macro invocations.  Because of this, parentheses require special handling.

See Also

Requirements

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

Sample Code

#include <boost/preprocessor/punctuation/paren_if.hpp>

#define MACRO(c, x) BOOST_PP_LPAREN_IF(c) x BOOST_PP_RPAREN_IF(c)

MACRO(0, text) // expands to text
MACRO(1, text) // expands to (text)

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