Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:43:27

0001 // Copyright Daniel Wallin 2005.
0002 // Distributed under the Boost Software License, Version 1.0.
0003 // (See accompanying file LICENSE_1_0.txt or copy at
0004 // http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #ifndef BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FLATTEN_HPP
0007 #define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FLATTEN_HPP
0008 
0009 #define BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT_required required,
0010 #define BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT_optional optional,
0011 #define BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT_deduced deduced,
0012 #define BOOST_PARAMETER_AUX_PP_FLATTEN_IDENTITY(x) x
0013 #define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC0_DUMMY_ELEM(z, n, data) ~
0014 
0015 #include <boost/preprocessor/cat.hpp>
0016 
0017 #define BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT(sub)                            \
0018     BOOST_PP_CAT(BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT_, sub)
0019 /**/
0020 
0021 #define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AS_DEDUCED(x)                    \
0022     BOOST_PP_CAT(deduced_, x)
0023 /**/
0024 
0025 #include <boost/preprocessor/detail/split.hpp>
0026 
0027 #define BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(sub)                        \
0028     BOOST_PP_SPLIT(0, BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT(sub))
0029 /**/
0030 
0031 #define BOOST_PARAMETER_AUX_PP_FLATTEN_ARGS(sub)                             \
0032     BOOST_PP_SPLIT(1, BOOST_PARAMETER_AUX_PP_FLATTEN_SPLIT(sub))
0033 /**/
0034 
0035 #include <boost/preprocessor/tuple/elem.hpp>
0036 
0037 #define BOOST_PARAMETER_AUX_PP_FLATTEN_ARITY_optional(arities)               \
0038     BOOST_PP_TUPLE_ELEM(3, 0, arities)
0039 /**/
0040 
0041 #define BOOST_PARAMETER_AUX_PP_FLATTEN_ARITY_required(arities)               \
0042     BOOST_PP_TUPLE_ELEM(3, 1, arities)
0043 /**/
0044 
0045 #include <boost/preprocessor/arithmetic/sub.hpp>
0046 #include <boost/preprocessor/repetition/enum_trailing.hpp>
0047 #include <boost/preprocessor/tuple/rem.hpp>
0048 
0049 #define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC0(r, n, elem, data)               \
0050     ((                                                                       \
0051         BOOST_PP_TUPLE_ELEM(3, 2, data)                                      \
0052       , BOOST_PP_TUPLE_REM(BOOST_PP_TUPLE_ELEM(3, 0, data)) elem             \
0053         BOOST_PP_ENUM_TRAILING(                                              \
0054             BOOST_PP_SUB(                                                    \
0055                 BOOST_PP_TUPLE_ELEM(3, 1, data)                              \
0056               , BOOST_PP_TUPLE_ELEM(3, 0, data)                              \
0057             )                                                                \
0058           , BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC0_DUMMY_ELEM                  \
0059           , ~                                                                \
0060         )                                                                    \
0061     ))
0062 /**/
0063 
0064 #include <boost/parameter/aux_/preprocessor/impl/for_each.hpp>
0065 
0066 #define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AUX(                             \
0067     r, arity, max_arity, spec, xform                                         \
0068 )                                                                            \
0069     BOOST_PARAMETER_AUX_PP_FOR_EACH_R(                                       \
0070         r                                                                    \
0071       , arity                                                                \
0072       , BOOST_PARAMETER_AUX_PP_FLATTEN_ARGS(spec)                            \
0073       , (                                                                    \
0074             arity                                                            \
0075           , max_arity                                                        \
0076           , xform(BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(spec))            \
0077         )                                                                    \
0078       , BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC0                                 \
0079     )
0080 /**/
0081 
0082 #define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_optional(r, arities, spec)       \
0083     BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AUX(                                 \
0084         r                                                                    \
0085       , BOOST_PP_CAT(                                                        \
0086             BOOST_PARAMETER_AUX_PP_FLATTEN_ARITY_                            \
0087           , BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(spec)                   \
0088         )(arities)                                                           \
0089       , BOOST_PP_TUPLE_ELEM(3, 2, arities)                                   \
0090       , spec                                                                 \
0091       , BOOST_PARAMETER_AUX_PP_FLATTEN_IDENTITY                              \
0092     )
0093 /**/
0094 
0095 #define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_required(r, arities, spec)       \
0096     BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_optional(r, arities, spec)
0097 /**/
0098 
0099 #define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_deduced_M(r, arities, n, spec)   \
0100     BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AUX(                                 \
0101         r                                                                    \
0102       , BOOST_PP_CAT(                                                        \
0103             BOOST_PARAMETER_AUX_PP_FLATTEN_ARITY_                            \
0104           , BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(spec)                   \
0105         )(arities)                                                           \
0106       , BOOST_PP_TUPLE_ELEM(3, 2, arities)                                   \
0107       , spec                                                                 \
0108       , BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_AS_DEDUCED                       \
0109     )
0110 /**/
0111 
0112 #include <boost/preprocessor/seq/for_each_i.hpp>
0113 
0114 #define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_deduced(r, arities, spec)        \
0115     BOOST_PP_SEQ_FOR_EACH_I_R(                                               \
0116         r                                                                    \
0117       , BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_deduced_M                        \
0118       , arities                                                              \
0119       , BOOST_PARAMETER_AUX_PP_FLATTEN_ARGS(spec)                            \
0120     )
0121 /**/
0122 
0123 #define BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC(r, arities, spec)                \
0124     BOOST_PP_CAT(                                                            \
0125         BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC_                                 \
0126       , BOOST_PARAMETER_AUX_PP_FLATTEN_QUALIFIER(spec)                       \
0127     )(r, arities, spec)
0128 /**/
0129 
0130 #include <boost/preprocessor/seq/for_each.hpp>
0131 
0132 #define BOOST_PARAMETER_AUX_PP_FLATTEN(                                      \
0133     opt_arity, req_arity, wanted_arity, specs                                \
0134 )                                                                            \
0135     BOOST_PP_SEQ_FOR_EACH(                                                   \
0136         BOOST_PARAMETER_AUX_PP_FLATTEN_SPEC                                  \
0137       , (opt_arity, req_arity, wanted_arity)                                 \
0138       , specs                                                                \
0139     )
0140 /**/
0141 
0142 #endif  // include guard
0143