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>BOOST_PP_WHILE()</li>
47 <li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
50 #define BOOST_PP_LIST_REST_N(COUNT,LIST) BOOST_PP_LIST_REST_N_D(0,COUNT,LIST)
52 /** <p>Can be used inside BOOST_PP_WHILE().</p> */
53 #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)))
54 #if !defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__)
55 # define BOOST_PP_LIST_REST_N_C(D,X) BOOST_PP_TUPLE_ELEM(2,1,X)
56 # define BOOST_PP_LIST_REST_N_F(D,X) (BOOST_PP_TUPLE_ELEM(3,1,BOOST_PP_TUPLE_ELEM(2,0,X)),BOOST_PP_DEC(BOOST_PP_TUPLE_ELEM(2,1,X)))
58 # define BOOST_PP_LIST_REST_N_C(D,X) BOOST_PP_TUPLE2_ELEM1 X
59 # define BOOST_PP_LIST_REST_N_F(D,X) (BOOST_PP_TUPLE3_ELEM1 BOOST_PP_TUPLE2_ELEM0 X,BOOST_PP_DEC(BOOST_PP_TUPLE2_ELEM1 X))