The BOOST_PP_LIST_AT_D macro extracts an element in a list.  It reenters BOOST_PP_WHILE with maximum efficiency.

Usage

BOOST_PP_LIST_AT_D(d, list, index)

Arguments

d
The next available BOOST_PP_WHILE iteration.
list
The list from which a element is to be extracted.  This list must have at least index + 1 elements.
index
The zero-based position in the list of the element to be extracted.

See Also

Requirements

Header:  <boost/preprocessor/list/at.hpp>

Sample Code

#include <boost/preprocessor/control/while.hpp>
#include <boost/preprocessor/list/at.hpp>

#define LIST (7, (2, (0, (1, BOOST_PP_NIL))))

#define PRED(d, state) BOOST_PP_LIST_AT_D(d, state, 0)
#define OP(d, state) BOOST_PP_LIST_REST(state)

BOOST_PP_WHILE(PRED, OP, LIST) // expands to (0, (1, BOOST_PP_NIL))

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)