The BOOST_PP_LIST_REST_N macro expands to a list of all but the first count elements of a list.


BOOST_PP_LIST_REST_N(count, list)


The number of elements to remove from the beginning of list.
The list from which the elements are extracted.


This macro removes count elements from the beginning of list and returns the remainder 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_REST_N_D in such a situation.

See Also


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

Sample Code

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

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

BOOST_PP_LIST_REST_N(2, LIST) // expands to (c, (d, 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