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