1 # /* ************************************************************************** 2 # * * 3 # * (C) Copyright Edward Diener 2014. 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/cat.hpp> 13 # include <boost/preprocessor/control/if.hpp> 14 # include <boost/preprocessor/tuple.hpp> 15 # include <libs/preprocessor/test/test.h> 16 17 #define TN_GEN_ONE(p) (1) 18 #define TN_GEN_ZERO(p) (0) 19 #define TN_TEST_ONE_MORE(parameter,ens) \ 20 BOOST_PP_IF \ 21 ( \ 22 BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(1,0,ens),0), \ 23 TN_GEN_ONE, \ 24 TN_GEN_ZERO \ 25 ) \ 26 (parameter) \ 27 /**/ 28 #define TN_TEST_ONE(parameter,ens) \ 29 BOOST_PP_TUPLE_ELEM \ 30 ( \ 31 1, \ 32 0, \ 33 TN_TEST_ONE_MORE(parameter,ens) \ 34 ) \ 35 /**/ 36 37 BEGIN TN_TEST_ONE(A,(1)) == 1 END 38 BEGIN TN_TEST_ONE(A,()) == 0 END 39