Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright Cromwell D. Enage 2017.
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_PACK_MAKE_PARAMETER_SPEC_ITEMS_HPP
0007 #define BOOST_PARAMETER_AUX_PACK_MAKE_PARAMETER_SPEC_ITEMS_HPP
0008 
0009 namespace boost { namespace parameter { namespace aux {
0010 
0011     // This recursive metafunction forwards successive elements of
0012     // parameters::parameter_spec to make_deduced_items<>.
0013     // -- Cromwell D. Enage
0014     template <typename SpecSeq>
0015     struct make_deduced_list;
0016 
0017     // Helper for match_parameters_base_cond<...>, below.
0018     template <typename ArgumentPackAndError, typename SpecSeq>
0019     struct match_parameters_base_cond_helper;
0020 
0021     // Helper metafunction for make_parameter_spec_items<...>, below.
0022     template <typename SpecSeq, typename ...Args>
0023     struct make_parameter_spec_items_helper;
0024 }}} // namespace boost::parameter::aux
0025 
0026 #include <boost/parameter/aux_/void.hpp>
0027 
0028 namespace boost { namespace parameter { namespace aux {
0029 
0030     template <typename SpecSeq>
0031     struct make_parameter_spec_items_helper<SpecSeq>
0032     {
0033         typedef ::boost::parameter::void_ type;
0034     };
0035 }}} // namespace boost::parameter::aux
0036 
0037 #include <boost/parameter/aux_/pack/make_deduced_items.hpp>
0038 
0039 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0040 #include <boost/mp11/list.hpp>
0041 #else
0042 #include <boost/mpl/front.hpp>
0043 #include <boost/mpl/pop_front.hpp>
0044 #endif
0045 
0046 namespace boost { namespace parameter { namespace aux {
0047 
0048     template <typename SpecSeq>
0049     struct make_deduced_list_not_empty
0050       : ::boost::parameter::aux::make_deduced_items<
0051 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0052             ::boost::mp11::mp_front<SpecSeq>
0053 #else
0054             typename ::boost::mpl::front<SpecSeq>::type
0055 #endif
0056           , ::boost::parameter::aux::make_deduced_list<
0057 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0058                 ::boost::mp11::mp_pop_front<SpecSeq>
0059 #else
0060                 typename ::boost::mpl::pop_front<SpecSeq>::type
0061 #endif
0062             >
0063         >
0064     {
0065     };
0066 }}} // namespace boost::parameter::aux
0067 
0068 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0069 #include <boost/mp11/utility.hpp>
0070 #else
0071 #include <boost/mpl/eval_if.hpp>
0072 #include <boost/mpl/empty.hpp>
0073 #include <boost/mpl/identity.hpp>
0074 #endif
0075 
0076 namespace boost { namespace parameter { namespace aux {
0077 
0078     template <typename SpecSeq>
0079     struct make_deduced_list
0080 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0081       : ::boost::mp11::mp_if<
0082             ::boost::mp11::mp_empty<SpecSeq>
0083           , ::boost::mp11::mp_identity< ::boost::parameter::void_>
0084 #else
0085       : ::boost::mpl::eval_if<
0086             ::boost::mpl::empty<SpecSeq>
0087           , ::boost::mpl::identity< ::boost::parameter::void_>
0088 #endif
0089           , ::boost::parameter::aux::make_deduced_list_not_empty<SpecSeq>
0090         >
0091     {
0092     };
0093 }}} // namespace boost::parameter::aux
0094 
0095 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0096 #include <type_traits>
0097 #else
0098 #include <boost/mpl/bool.hpp>
0099 #include <boost/mpl/pair.hpp>
0100 #include <boost/mpl/if.hpp>
0101 #include <boost/type_traits/is_same.hpp>
0102 
0103 namespace boost { namespace parameter { namespace aux {
0104 
0105     template <typename ArgumentPackAndError>
0106     struct is_arg_pack_error_void
0107       : ::boost::mpl::if_<
0108             ::boost::is_same<
0109                 typename ::boost::mpl::second<ArgumentPackAndError>::type
0110               , ::boost::parameter::void_
0111             >
0112           , ::boost::mpl::true_
0113           , ::boost::mpl::false_
0114         >::type
0115     {
0116     };
0117 }}} // namespace boost::parameter::aux
0118 
0119 #endif  // BOOST_PARAMETER_CAN_USE_MP11
0120 
0121 namespace boost { namespace parameter { namespace aux {
0122 
0123     // Checks if the arguments match the criteria of overload resolution.
0124     // If NamedList satisfies the PS0, PS1, ..., this is a metafunction
0125     // returning parameters.  Otherwise it has no nested ::type.
0126     template <typename ArgumentPackAndError, typename SpecSeq>
0127 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0128     using match_parameters_base_cond = ::boost::mp11::mp_if<
0129         ::boost::mp11::mp_empty<SpecSeq>
0130       , ::std::is_same<
0131             ::boost::mp11::mp_at_c<ArgumentPackAndError,1>
0132           , ::boost::parameter::void_
0133         >
0134       , ::boost::parameter::aux::match_parameters_base_cond_helper<
0135             ArgumentPackAndError
0136           , SpecSeq
0137         >
0138     >;
0139 #else
0140     struct match_parameters_base_cond
0141       : ::boost::mpl::eval_if<
0142             ::boost::mpl::empty<SpecSeq>
0143           , ::boost::parameter::aux
0144             ::is_arg_pack_error_void<ArgumentPackAndError>
0145           , ::boost::parameter::aux::match_parameters_base_cond_helper<
0146                 ArgumentPackAndError
0147               , SpecSeq
0148             >
0149         >
0150     {
0151     };
0152 #endif  // BOOST_PARAMETER_CAN_USE_MP11
0153 }}} // namespace boost::parameter::aux
0154 
0155 #include <boost/parameter/aux_/pack/satisfies.hpp>
0156 
0157 namespace boost { namespace parameter { namespace aux {
0158 
0159     template <typename ArgumentPackAndError, typename SpecSeq>
0160     struct match_parameters_base_cond_helper
0161 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0162       : ::boost::mp11::mp_if<
0163 #else
0164       : ::boost::mpl::eval_if<
0165 #endif
0166             ::boost::parameter::aux::satisfies_requirements_of<
0167 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0168                 ::boost::mp11::mp_at_c<ArgumentPackAndError,0>
0169               , ::boost::mp11::mp_front<SpecSeq>
0170 #else
0171                 typename ::boost::mpl::first<ArgumentPackAndError>::type
0172               , typename ::boost::mpl::front<SpecSeq>::type
0173 #endif
0174             >
0175           , ::boost::parameter::aux::match_parameters_base_cond<
0176                 ArgumentPackAndError
0177 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0178               , ::boost::mp11::mp_pop_front<SpecSeq>
0179 #else
0180               , typename ::boost::mpl::pop_front<SpecSeq>::type
0181 #endif
0182             >
0183 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0184           , ::boost::mp11::mp_false
0185 #else
0186           , ::boost::mpl::false_
0187 #endif
0188         >
0189     {
0190     };
0191 
0192     // This parameters item chaining metafunction class does not require
0193     // the lengths of the SpecSeq and of Args parameter pack to match.
0194     // Used by argument_pack to build the items in the resulting arg_list.
0195     // -- Cromwell D. Enage
0196     template <typename SpecSeq, typename ...Args>
0197 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0198     using make_parameter_spec_items = ::boost::mp11::mp_if<
0199         ::boost::mp11::mp_empty<SpecSeq>
0200       , ::boost::mp11::mp_identity< ::boost::parameter::void_>
0201       , ::boost::parameter::aux
0202         ::make_parameter_spec_items_helper<SpecSeq,Args...>
0203     >;
0204 #else
0205     struct make_parameter_spec_items
0206       : ::boost::mpl::eval_if<
0207             ::boost::mpl::empty<SpecSeq>
0208           , ::boost::mpl::identity< ::boost::parameter::void_>
0209           , ::boost::parameter::aux
0210             ::make_parameter_spec_items_helper<SpecSeq,Args...>
0211         >
0212     {
0213     };
0214 #endif
0215 }}} // namespace boost::parameter::aux
0216 
0217 #include <boost/parameter/aux_/pack/make_items.hpp>
0218 
0219 namespace boost { namespace parameter { namespace aux {
0220 
0221     template <typename SpecSeq, typename A0, typename ...Args>
0222     struct make_parameter_spec_items_helper<SpecSeq,A0,Args...>
0223       : ::boost::parameter::aux::make_items<
0224 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0225             ::boost::mp11::mp_front<SpecSeq>
0226 #else
0227             typename ::boost::mpl::front<SpecSeq>::type
0228 #endif
0229           , A0
0230           , ::boost::parameter::aux::make_parameter_spec_items<
0231 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0232                 ::boost::mp11::mp_pop_front<SpecSeq>
0233 #else
0234                 typename ::boost::mpl::pop_front<SpecSeq>::type
0235 #endif
0236               , Args...
0237             >
0238         >
0239     {
0240     };
0241 }}} // namespace boost::parameter::aux
0242 
0243 #endif  // include guard
0244