]> git.lyx.org Git - lyx.git/blob - boost/boost/preprocessor/list/rest_n.hpp
major boost update
[lyx.git] / boost / boost / preprocessor / list / rest_n.hpp
1 #ifndef BOOST_PREPROCESSOR_LIST_REST_N_HPP
2 #define BOOST_PREPROCESSOR_LIST_REST_N_HPP
3
4 /* Copyright (C) 2001
5  * Housemarque Oy
6  * http://www.housemarque.com
7  *
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.
12  *
13  * See http://www.boost.org for most recent version.
14  */
15
16 #include <boost/preprocessor/dec.hpp>
17 #include <boost/preprocessor/list/adt.hpp>
18 #include <boost/preprocessor/while.hpp>
19
20 /** <p>Expands to a list of all but the first <code>COUNT</code> elements of the
21 list <code>LIST</code>.</p>
22
23 <p>For example,</p>
24
25 <pre>
26 BOOST_PP_LIST_REST_N(2,BOOST_PP_TUPLE_TO_LIST(4,(+,-,*,/)))
27 </pre>
28
29 <p>expands to the same as:</p>
30
31 <pre>
32 BOOST_PP_TUPLE_TO_LIST(2,(*,/))
33 </pre>
34
35 <h3>See</h3>
36 <ul>
37   <li>BOOST_PP_LIST_FIRST_N()</li>
38 </ul>
39
40 <h3>Uses</h3>
41 <ul>
42   <li>BOOST_PP_WHILE()</li>
43 </ul>
44
45 <h3>Test</h3>
46 <ul>
47   <li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
48 </ul>
49 */
50 #define BOOST_PP_LIST_REST_N(COUNT,LIST) BOOST_PP_LIST_REST_N_D(0,COUNT,LIST)
51
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)))
57 #else
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))
60 #endif
61 #endif