The BOOST_PP_MAX_D macro expands to the greater of its second and third arguments.  It reenters BOOST_PP_WHILE with maximum efficiency.

Usage

BOOST_PP_MAX_D(d, x, y)

Arguments

d
The next available BOOST_PP_WHILE iteration. 
x
The first operand.  Valid values range from 0 to BOOST_PP_LIMIT_MAG.
y
The second operand.  Valid values range from 0 to BOOST_PP_LIMIT_MAG.

Remarks

This macro returns the greater of its first and second arguments or the value of both arguments if they are equal.

See Also

Requirements

Header:  <boost/preprocessor/selection/max.hpp>

Sample Code

#include <boost/preprocessor/list/fold_left.hpp>
#include <boost/preprocessor/selection/max.hpp>

#define LIST (1, (3, (5, (2, (4, BOOST_PP_NIL)))))

#define OP(d, state, x) BOOST_PP_MAX_D(d, state, x)

#define LIST_MAX(list) BOOST_PP_LIST_FOLD_LEFT(OP, 0, LIST)

LIST_MAX(LIST) // expands to 5

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