The BOOST_PP_ADD macro expands to the sum of its arguments.

Usage

BOOST_PP_ADD(x, y)

Arguments

x
The first addend of the operation.  Valid values range from 0 to BOOST_PP_LIMIT_MAG.
y
The second addend of the operation.  Valid values range from 0 to BOOST_PP_LIMIT_MAG.

Remarks

If the sum of x and y is greater than BOOST_PP_LIMIT_MAG, the result is saturated to BOOST_PP_LIMIT_MAG.
Previously, this macro could not be used inside BOOST_PP_WHILE.  There is no longer any such restriction.  It is more efficient, however, to use BOOST_PP_ADD_D in such a situation.
This macro is the most efficient when x is less than or equal to y.  However, the efficiency gain is not worth actually comparing the two arguments prior to invocation.  In other words, x should be the addend that is most likely to be the largest of the two operands.

See Also

Requirements

Header:  <boost/preprocessor/arithmetic/add.hpp>

Sample Code

#include <boost/preprocessor/arithmetic/add.hpp>

BOOST_PP_ADD(4, 3) // expands to 7

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)