File indexing completed on 2025-01-18 09:49:28
0001 #
0002
0003
0004
0005
0006
0007
0008
0009 #
0010 #
0011 #
0012 # ifndef BOOST_PREPROCESSOR_SEQ_FOR_EACH_HPP
0013 # define BOOST_PREPROCESSOR_SEQ_FOR_EACH_HPP
0014 #
0015 # include <boost/preprocessor/arithmetic/dec.hpp>
0016 # include <boost/preprocessor/config/config.hpp>
0017 # include <boost/preprocessor/control/if.hpp>
0018 # include <boost/preprocessor/control/iif.hpp>
0019 # include <boost/preprocessor/repetition/for.hpp>
0020 # include <boost/preprocessor/seq/seq.hpp>
0021 # include <boost/preprocessor/seq/size.hpp>
0022 # include <boost/preprocessor/seq/detail/is_empty.hpp>
0023 # include <boost/preprocessor/tuple/elem.hpp>
0024 # include <boost/preprocessor/tuple/rem.hpp>
0025 #
0026 #
0027 #
0028 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
0029 # define BOOST_PP_SEQ_FOR_EACH(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK(macro, data, seq)
0030 # else
0031 # define BOOST_PP_SEQ_FOR_EACH(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_D(macro, data, seq)
0032 # define BOOST_PP_SEQ_FOR_EACH_D(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK(macro, data, seq)
0033 # endif
0034 #
0035 # define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EXEC(macro, data, seq) BOOST_PP_FOR((macro, data, seq, BOOST_PP_SEQ_SIZE(seq)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M)
0036 # define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY(macro, data, seq)
0037 #
0038 # define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK(macro, data, seq) \
0039 BOOST_PP_IIF \
0040 ( \
0041 BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \
0042 BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EXEC, \
0043 BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY \
0044 ) \
0045 (macro, data, seq) \
0046
0047 #
0048 # define BOOST_PP_SEQ_FOR_EACH_P(r, x) BOOST_PP_TUPLE_ELEM(4, 3, x)
0049 #
0050 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
0051 # define BOOST_PP_SEQ_FOR_EACH_O(r, x) BOOST_PP_SEQ_FOR_EACH_O_I x
0052 # else
0053 # define BOOST_PP_SEQ_FOR_EACH_O(r, x) BOOST_PP_SEQ_FOR_EACH_O_I(BOOST_PP_TUPLE_ELEM(4, 0, x), BOOST_PP_TUPLE_ELEM(4, 1, x), BOOST_PP_TUPLE_ELEM(4, 2, x), BOOST_PP_TUPLE_ELEM(4, 3, x))
0054 # endif
0055 #
0056 # define BOOST_PP_SEQ_FOR_EACH_O_I(macro, data, seq, sz) \
0057 BOOST_PP_SEQ_FOR_EACH_O_I_DEC(macro, data, seq, BOOST_PP_DEC(sz)) \
0058
0059 # define BOOST_PP_SEQ_FOR_EACH_O_I_DEC(macro, data, seq, sz) \
0060 ( \
0061 macro, \
0062 data, \
0063 BOOST_PP_IF \
0064 ( \
0065 sz, \
0066 BOOST_PP_SEQ_FOR_EACH_O_I_TAIL, \
0067 BOOST_PP_SEQ_FOR_EACH_O_I_NIL \
0068 ) \
0069 (seq), \
0070 sz \
0071 ) \
0072
0073 # define BOOST_PP_SEQ_FOR_EACH_O_I_TAIL(seq) BOOST_PP_SEQ_TAIL(seq)
0074 # define BOOST_PP_SEQ_FOR_EACH_O_I_NIL(seq) BOOST_PP_NIL
0075 #
0076 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
0077 # define BOOST_PP_SEQ_FOR_EACH_M(r, x) BOOST_PP_SEQ_FOR_EACH_M_IM(r, BOOST_PP_TUPLE_REM_4 x)
0078 # define BOOST_PP_SEQ_FOR_EACH_M_IM(r, im) BOOST_PP_SEQ_FOR_EACH_M_I(r, im)
0079 # else
0080 # define BOOST_PP_SEQ_FOR_EACH_M(r, x) BOOST_PP_SEQ_FOR_EACH_M_I(r, BOOST_PP_TUPLE_ELEM(4, 0, x), BOOST_PP_TUPLE_ELEM(4, 1, x), BOOST_PP_TUPLE_ELEM(4, 2, x), BOOST_PP_TUPLE_ELEM(4, 3, x))
0081 # endif
0082 #
0083 # define BOOST_PP_SEQ_FOR_EACH_M_I(r, macro, data, seq, sz) macro(r, data, BOOST_PP_SEQ_HEAD(seq))
0084 #
0085 #
0086 #
0087 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
0088 # define BOOST_PP_SEQ_FOR_EACH_R(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_R(r, macro, data, seq)
0089 # else
0090 # define BOOST_PP_SEQ_FOR_EACH_R(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq)
0091 # define BOOST_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_R(r, macro, data, seq)
0092 # endif
0093 #
0094 # define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EXEC_R(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq, BOOST_PP_SEQ_SIZE(seq)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M)
0095 # define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY_R(r, macro, data, seq)
0096 #
0097 # define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_R(r, macro, data, seq) \
0098 BOOST_PP_IIF \
0099 ( \
0100 BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \
0101 BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EXEC_R, \
0102 BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY_R \
0103 ) \
0104 (r, macro, data, seq) \
0105
0106 #
0107 # endif