1 #ifndef BOOST_PREPROCESSOR_LIST_REST_N_HPP
2 #define BOOST_PREPROCESSOR_LIST_REST_N_HPP
6 * http://www.housemarque.com
8 * Permission to copy, use, modify, sell and distribute this software is
9 * granted provided this copyright notice appears in all copies. This
10 * software is provided "as is" without express or implied warranty, and
11 * with no claim as to its suitability for any purpose.
13 * See http://www.boost.org for most recent version.
16 #include <boost/preprocessor/dec.hpp>
17 #include <boost/preprocessor/list/adt.hpp>
18 #include <boost/preprocessor/while.hpp>
20 /** <p>Expands to a list of all but the first <code>COUNT</code> elements of the
21 list <code>LIST</code>.</p>
26 BOOST_PP_LIST_REST_N(2,BOOST_PP_TUPLE_TO_LIST(4,(+,-,*,/)))
29 <p>expands to the same as:</p>
32 BOOST_PP_TUPLE_TO_LIST(2,(*,/))
37 <li>BOOST_PP_LIST_FIRST_N()</li>
42 <li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
45 #define BOOST_PP_LIST_REST_N(COUNT,LIST) BOOST_PP_LIST_REST_N_D(0,COUNT,LIST)
47 /** <p>Can be used inside BOOST_PP_WHILE() (see for an explanation of the D parameter).</p> */
48 #define BOOST_PP_LIST_REST_N_D(D,COUNT,LIST) BOOST_PP_TUPLE_ELEM(2,0,BOOST_PP_WHILE##D(BOOST_PP_LIST_REST_N_C,BOOST_PP_LIST_REST_N_F,(LIST,COUNT)))
50 #define BOOST_PP_LIST_REST_N_C(D,LC) BOOST_PP_TUPLE_ELEM(2,1,LC)
51 #define BOOST_PP_LIST_REST_N_F(D,LC) (BOOST_PP_TUPLE_ELEM(3,1,BOOST_PP_TUPLE_ELEM(2,0,LC)),BOOST_PP_DEC(BOOST_PP_TUPLE_ELEM(2,1,LC)))