Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/preprocessor/test/control.cpp @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

File size: 1.5 KB
Line 
1# /* **************************************************************************
2#  *                                                                          *
3#  *     (C) Copyright Paul Mensonides 2002.
4#  *     Distributed under the Boost Software License, Version 1.0. (See
5#  *     accompanying file LICENSE_1_0.txt or copy at
6#  *     http://www.boost.org/LICENSE_1_0.txt)
7#  *                                                                          *
8#  ************************************************************************** */
9#
10# /* See http://www.boost.org for most recent version. */
11#
12# include <boost/preprocessor/arithmetic/add.hpp>
13# include <boost/preprocessor/arithmetic/dec.hpp>
14# include <boost/preprocessor/control.hpp>
15# include <libs/preprocessor/test/test.h>
16
17# define TR(x) 1
18
19BEGIN BOOST_PP_EXPR_IIF(0, TR)(0) == 0 END
20BEGIN BOOST_PP_EXPR_IIF(1, TR)(0) == 1 END
21
22BEGIN BOOST_PP_EXPR_IF(3, TR)(0) == 1 END
23BEGIN BOOST_PP_EXPR_IF(0, TR)(0) == 0 END
24
25BEGIN BOOST_PP_IIF(0, 1, 0) == 0 END
26BEGIN BOOST_PP_IIF(1, 1, 0) == 1 END
27
28BEGIN BOOST_PP_IF(0, 1, 0) == 0 END
29BEGIN BOOST_PP_IF(9, 1, 0) == 1 END
30
31# define PRED(d, state) state
32# define OP_1(d, state) BOOST_PP_DEC(state)
33
34BEGIN BOOST_PP_WHILE(PRED, OP_1, 50) == 0 END
35
36# define OP_2(d, state) BOOST_PP_DEC(BOOST_PP_ADD(BOOST_PP_WHILE(PRED, OP_1, state), state))
37# define OP_3(d, state) BOOST_PP_DEC(BOOST_PP_ADD_D(d, BOOST_PP_WHILE_ ## d(PRED, OP_1, state), state))
38
39BEGIN BOOST_PP_WHILE(PRED, OP_2, 10) == 0 END
40BEGIN BOOST_PP_WHILE(PRED, OP_3, 10) == 0 END
Note: See TracBrowser for help on using the repository browser.