Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:49:58

0001 // Copyright Cromwell D. Enage 2019.
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_COMPOSE_HPP
0007 #define BOOST_PARAMETER_COMPOSE_HPP
0008 
0009 #include <boost/parameter/aux_/arg_list.hpp>
0010 
0011 namespace boost { namespace parameter {
0012 
0013     inline BOOST_CONSTEXPR ::boost::parameter::aux::empty_arg_list compose()
0014     {
0015         return ::boost::parameter::aux::empty_arg_list();
0016     }
0017 }} // namespace boost::parameter
0018 
0019 #include <boost/parameter/config.hpp>
0020 
0021 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
0022 
0023 namespace boost { namespace parameter { namespace aux {
0024 
0025 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0026     template <typename ...TaggedArgs>
0027     struct compose_arg_list
0028     {
0029         using type = ::boost::parameter::aux::flat_like_arg_list<
0030             ::boost::parameter::aux::flat_like_arg_tuple<
0031                 typename TaggedArgs::base_type::key_type
0032               , typename TaggedArgs::base_type
0033             >...
0034         >;
0035     };
0036 #else   // !defined(BOOST_PARAMETER_CAN_USE_MP11)
0037     template <typename TaggedArg0, typename ...TaggedArgs>
0038     struct compose_arg_list;
0039 
0040     template <typename TaggedArg0>
0041     struct compose_arg_list<TaggedArg0>
0042     {
0043         typedef ::boost::parameter::aux::arg_list<TaggedArg0> type;
0044     };
0045 
0046     template <typename TaggedArg0, typename ...TaggedArgs>
0047     struct compose_arg_list
0048     {
0049         typedef ::boost::parameter::aux::arg_list<
0050             TaggedArg0
0051           , typename ::boost::parameter::aux
0052             ::compose_arg_list<TaggedArgs...>::type
0053         > type;
0054     };
0055 #endif  // BOOST_PARAMETER_CAN_USE_MP11
0056 }}} // namespace boost::parameter::aux
0057 
0058 #include <boost/parameter/are_tagged_arguments.hpp>
0059 #include <boost/core/enable_if.hpp>
0060 
0061 namespace boost { namespace parameter { namespace result_of {
0062 
0063     template <typename ...TaggedArgs>
0064     struct compose
0065       : ::boost::lazy_enable_if<
0066             ::boost::parameter::are_tagged_arguments<TaggedArgs...>
0067           , ::boost::parameter::aux::compose_arg_list<TaggedArgs...>
0068         >
0069     {
0070     };
0071 
0072     template <>
0073     struct compose<>
0074     {
0075         typedef ::boost::parameter::aux::empty_arg_list type;
0076     };
0077 }}} // namespace boost::parameter::result_of
0078 
0079 namespace boost { namespace parameter {
0080 
0081     template <typename TaggedArg0, typename ...TaggedArgs>
0082     inline BOOST_CONSTEXPR typename ::boost::parameter::result_of
0083     ::compose<TaggedArg0,TaggedArgs...>::type
0084         compose(TaggedArg0 const& arg0, TaggedArgs const&... args)
0085     {
0086         return typename ::boost::parameter::aux
0087         ::compose_arg_list<TaggedArg0,TaggedArgs...>::type(
0088             ::boost::parameter::aux::value_type_is_not_void()
0089           , arg0
0090           , args...
0091         );
0092     }
0093 }} // namespace boost::parameter
0094 
0095 #else   // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
0096 
0097 #define BOOST_PARAMETER_compose_arg_list_type_suffix(z, n, suffix) suffix
0098 
0099 #include <boost/preprocessor/cat.hpp>
0100 
0101 #define BOOST_PARAMETER_compose_arg_list_type_prefix(z, n, prefix)           \
0102     ::boost::parameter::aux::arg_list<BOOST_PP_CAT(prefix, n)
0103 /**/
0104 
0105 #include <boost/preprocessor/facilities/intercept.hpp>
0106 #include <boost/preprocessor/repetition/enum.hpp>
0107 #include <boost/preprocessor/repetition/repeat.hpp>
0108 
0109 #define BOOST_PARAMETER_compose_arg_list_type(z, n, prefix)                  \
0110     BOOST_PP_CAT(BOOST_PP_ENUM_, z)(                                         \
0111         n, BOOST_PARAMETER_compose_arg_list_type_prefix, prefix              \
0112     ) BOOST_PP_CAT(BOOST_PP_REPEAT_, z)(                                     \
0113         n, BOOST_PARAMETER_compose_arg_list_type_suffix, >                   \
0114     )
0115 /**/
0116 
0117 #include <boost/parameter/aux_/void.hpp>
0118 #include <boost/preprocessor/arithmetic/inc.hpp>
0119 #include <boost/preprocessor/arithmetic/sub.hpp>
0120 #include <boost/preprocessor/repetition/enum_params.hpp>
0121 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
0122 #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
0123 
0124 #if defined(BOOST_NO_SFINAE)
0125 #define BOOST_PARAMETER_compose_arg_list_function_overload(z, n, prefix)     \
0126     template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)>                 \
0127     inline BOOST_CONSTEXPR                                                   \
0128     BOOST_PARAMETER_compose_arg_list_type(z, n, prefix)                      \
0129         compose(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, prefix, const& a))       \
0130     {                                                                        \
0131         return BOOST_PARAMETER_compose_arg_list_type(z, n, prefix)(          \
0132             BOOST_PP_ENUM_PARAMS_Z(z, n, a)                                  \
0133             BOOST_PP_ENUM_TRAILING_PARAMS_Z(                                 \
0134                 z                                                            \
0135               , BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, n)           \
0136               , ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT \
0137             )                                                                \
0138         );                                                                   \
0139     }
0140 /**/
0141 #else   // !defined(BOOST_NO_SFINAE)
0142 #include <boost/parameter/are_tagged_arguments.hpp>
0143 #include <boost/core/enable_if.hpp>
0144 
0145 namespace boost { namespace parameter { namespace result_of {
0146 
0147     template <
0148         BOOST_PP_ENUM_BINARY_PARAMS(
0149             BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY)
0150           , typename TaggedArg
0151           , = void BOOST_PP_INTERCEPT
0152         )
0153     >
0154     struct compose;
0155 
0156     template <>
0157     struct compose<>
0158     {
0159         typedef ::boost::parameter::aux::empty_arg_list type;
0160     };
0161 }}} // namespace boost::parameter::result_of
0162 
0163 #define BOOST_PARAMETER_compose_arg_list_function_overload(z, n, prefix)     \
0164 namespace boost { namespace parameter { namespace result_of {                \
0165     template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)>                 \
0166     struct compose<BOOST_PP_ENUM_PARAMS_Z(z, n, prefix)>                     \
0167       : ::boost::enable_if<                                                  \
0168             ::boost::parameter                                               \
0169             ::are_tagged_arguments<BOOST_PP_ENUM_PARAMS_Z(z, n, prefix)>     \
0170           , BOOST_PARAMETER_compose_arg_list_type(z, n, prefix)              \
0171         >                                                                    \
0172     {                                                                        \
0173     };                                                                       \
0174 }}}                                                                          \
0175 namespace boost { namespace parameter {                                      \
0176     template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)>                 \
0177     inline BOOST_CONSTEXPR typename ::boost::parameter::result_of            \
0178     ::compose<BOOST_PP_ENUM_PARAMS_Z(z, n, prefix)>::type                    \
0179         compose(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, prefix, const& a))       \
0180     {                                                                        \
0181         return BOOST_PARAMETER_compose_arg_list_type(z, n, prefix)(          \
0182             BOOST_PP_ENUM_PARAMS_Z(z, n, a)                                  \
0183             BOOST_PP_ENUM_TRAILING_PARAMS_Z(                                 \
0184                 z                                                            \
0185               , BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, n)           \
0186               , ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT \
0187             )                                                                \
0188         );                                                                   \
0189     }                                                                        \
0190 }}
0191 /**/
0192 #endif  // BOOST_NO_SFINAE
0193 
0194 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
0195 
0196 BOOST_PP_REPEAT_FROM_TO(
0197     1
0198   , BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY)
0199   , BOOST_PARAMETER_compose_arg_list_function_overload
0200   , TaggedArg
0201 )
0202 
0203 #undef BOOST_PARAMETER_compose_arg_list_function_overload
0204 #undef BOOST_PARAMETER_compose_arg_list_type
0205 #undef BOOST_PARAMETER_compose_arg_list_type_prefix
0206 #undef BOOST_PARAMETER_compose_arg_list_type_suffix
0207 
0208 #endif  // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
0209 #endif  // include guard
0210