]> git.lyx.org Git - lyx.git/blob - boost/boost/preprocessor/list/size.hpp
update
[lyx.git] / boost / boost / preprocessor / list / size.hpp
1 #ifndef BOOST_PREPROCESSOR_LIST_SIZE_HPP
2 #define BOOST_PREPROCESSOR_LIST_SIZE_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/list/fold_left.hpp>
17 #include <boost/preprocessor/inc.hpp>
18
19 /** <p>Expands to the number of elements in the list.</p>
20
21 <p>For example,</p>
22
23 <pre>
24 BOOST_PP_LIST_SIZE(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
25 </pre>
26
27 <p>expands to <code>3</code>.</p>
28
29 <h3>Test</h3>
30 <ul>
31   <li><a href="../../test/list_test.cpp">list_test.cpp</a></li>
32 </ul>
33 */
34 #define BOOST_PP_LIST_SIZE(LIST) BOOST_PP_LIST_SIZE_D(0,LIST)
35
36 /** <p>Can be used inside BOOST_PP_WHILE() (see for an explanation of the D parameter).</p> */
37 #define BOOST_PP_LIST_SIZE_D(D,LIST) BOOST_PP_LIST_FOLD_LEFT_D(D,BOOST_PP_LIST_SIZE_F,0,LIST)
38 #define BOOST_PP_LIST_SIZE_F(D,S,X) BOOST_PP_INC(S)
39 #endif