The BOOST_PP_LIST_FIRST_N_D macro expands to a list of the first count elements of a list. It reenters BOOST_PP_WHILE with maximum efficiency.

#### Usage

BOOST_PP_LIST_FIRST_N_D(d, count, list)

#### Arguments

d
  The next available BOOST_PP_WHILE iteration.
count
  The number of elements to extract.
list
  The list from which the elements are extracted.

#### Remarks

This macro extracts count elements from the beginning of list and returns them as a list

#### See Also

- BOOST_PP_LIST_FIRST_N

#### Requirements

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

#### Sample Code

    #include <boost/preprocessor/list/first_n.hpp>
    #include <boost/preprocessor/list/fold_right.hpp>

    #define L1 (a, (b, (c, (d, BOOST_PP_NIL))))
    #define L2 (L1, (L1, (L1, BOOST_PP_NIL)))

    #define OP(d, state, x) (BOOST_PP_LIST_FIRST_N_D(d, 2, x), state)

    BOOST_PP_LIST_FOLD_RIGHT(OP, BOOST_PP_NIL, L2)
    /*
       expands to...
       ((a, (b, BOOST_PP_NIL)), ((a, (b, BOOST_PP_NIL)),
       ((a, (b, BOOST_PP_NIL)) , BOOST_PP_NIL )))
    */