The BOOST_PP_LIST_FIRST_N macro expands to a list of the first count elements of a list.

Usage

BOOST_PP_LIST_FIRST_N(count, list)

Arguments

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
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_LIST_FIRST_N_D in such a situation.

See Also

Requirements

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

Sample Code

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

#define LIST (a, (b, (c, BOOST_PP_NIL)))

BOOST_PP_LIST_FIRST_N(2, LIST) // expands to (a, (b, 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)