Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright Daniel Wallin 2006.
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_SPLIT_ARGS_HPP
0007 #define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_SPLIT_ARGS_HPP
0008 
0009 #include <boost/preprocessor/tuple/elem.hpp>
0010 
0011 // Accessor macros for the split_args tuple.
0012 #define BOOST_PARAMETER_SPLIT_ARG_REQ_COUNT(x) BOOST_PP_TUPLE_ELEM(4, 0, x)
0013 #define BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ(x) BOOST_PP_TUPLE_ELEM(4, 1, x)
0014 #define BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT(x) BOOST_PP_TUPLE_ELEM(4, 2, x)
0015 #define BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(x) BOOST_PP_TUPLE_ELEM(4, 3, x)
0016 
0017 #include <boost/preprocessor/arithmetic/inc.hpp>
0018 #include <boost/preprocessor/seq/push_back.hpp>
0019 
0020 // Helper macros for BOOST_PARAMETER_FUNCTION_SPLIT_ARGS.
0021 #define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_required(s_a, arg)                \
0022     (                                                                        \
0023         BOOST_PP_INC(BOOST_PARAMETER_SPLIT_ARG_REQ_COUNT(s_a))               \
0024       , BOOST_PP_SEQ_PUSH_BACK(BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ(s_a), arg)  \
0025       , BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT(s_a)                             \
0026       , BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(s_a)                               \
0027     )
0028 /**/
0029 
0030 #define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_deduced_required(split_args, arg) \
0031     BOOST_PARAMETER_FUNCTION_SPLIT_ARG_required(split_args, arg)
0032 /**/
0033 
0034 #define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_optional(s_a, arg)                \
0035     (                                                                        \
0036         BOOST_PARAMETER_SPLIT_ARG_REQ_COUNT(s_a)                             \
0037       , BOOST_PARAMETER_SPLIT_ARG_REQ_SEQ(s_a)                               \
0038       , BOOST_PP_INC(BOOST_PARAMETER_SPLIT_ARG_OPT_COUNT(s_a))               \
0039       , BOOST_PP_SEQ_PUSH_BACK(BOOST_PARAMETER_SPLIT_ARG_OPT_SEQ(s_a), arg)  \
0040     )
0041 /**/
0042 
0043 #define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_deduced_optional(split_args, arg) \
0044     BOOST_PARAMETER_FUNCTION_SPLIT_ARG_optional(split_args, arg)
0045 /**/
0046 
0047 #include <boost/parameter/aux_/preprocessor/impl/argument_specs.hpp>
0048 #include <boost/preprocessor/cat.hpp>
0049 
0050 #define BOOST_PARAMETER_FUNCTION_SPLIT_ARG(s, split_args, arg)               \
0051     BOOST_PP_CAT(                                                            \
0052         BOOST_PARAMETER_FUNCTION_SPLIT_ARG_                                  \
0053       , BOOST_PARAMETER_FN_ARG_QUALIFIER(arg)                                \
0054     )(split_args, arg)
0055 /**/
0056 
0057 #include <boost/preprocessor/seq/fold_left.hpp>
0058 #include <boost/preprocessor/seq/seq.hpp>
0059 
0060 // Expands from the flattened BOOST_PARAMETER_FUNCTION et. al. arg sequence to
0061 // the tuple (required_count, required_args, optional_count, optional_args).
0062 #define BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args)                            \
0063     BOOST_PP_SEQ_FOLD_LEFT(                                                  \
0064         BOOST_PARAMETER_FUNCTION_SPLIT_ARG                                   \
0065       , (0, BOOST_PP_SEQ_NIL, 0, BOOST_PP_SEQ_NIL)                           \
0066       , args                                                                 \
0067     )
0068 /**/
0069 
0070 #endif  // include guard
0071