BOOST_PP_IIF マクロはビット状態に基づいて、 2つの値からひとつを選択する。

Usage

BOOST_PP_IIF(bit, t, f)

Arguments

bit
結果が tf かを決定する条件。 この値は 01 に展開されなければならない。
t
bit1 の時に展開される結果。
f
bit2 の時に展開される結果。

Remarks

このマクロは第1引数に対してブール値への変換を 行わない。 もし変換が必要なら、代わりに BOOST_PP_IF を使うこと。

See Also

Requirements

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

Sample Code

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

#define OR_IF(p, q, t, f) BOOST_PP_IIF(BOOST_PP_OR(p, q), t, f)

OR_IF(1, 0, abc, xyz) // expands to abc
OF_IF(0, 0, abc, xyz) // expands to xyz