The BOOST_PP_IF macro chooses between to values based on a logical condition.

Usage

BOOST_PP_IF(cond, t, f)

Arguments

cond
The condition that determines if the result is expr or nothing.  Valid values range from 0 to BOOST_PP_LIMIT_MAG.
t
The result of the expansion if cond is non-zero.
f
The result of the expansion if cond is 0.

Remarks

This macro performs a boolean conversion on its first argument.  If that conversion is unnecessary, use BOOST_PP_IIF instead.

See Also

Requirements

Header:  <boost/preprocessor/control/if.hpp>

Sample Code

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

BOOST_PP_IF(10, a, b) // expands to a
BOOST_PP_IF(0, a, b) // expands to b

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