File indexing completed on 2025-01-18 09:43:30
0001
0002
0003
0004
0005
0006 #ifndef BOOST_PARAMETER_BINDING_DWA200558_HPP
0007 #define BOOST_PARAMETER_BINDING_DWA200558_HPP
0008
0009 #include <boost/parameter/aux_/void.hpp>
0010 #include <boost/parameter/config.hpp>
0011
0012 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0013 #include <boost/mp11/integral.hpp>
0014 #include <boost/mp11/list.hpp>
0015 #include <boost/mp11/utility.hpp>
0016 #include <type_traits>
0017 #else
0018 #include <boost/mpl/bool.hpp>
0019 #include <boost/mpl/if.hpp>
0020 #include <boost/mpl/eval_if.hpp>
0021 #include <boost/mpl/identity.hpp>
0022 #include <boost/mpl/apply_wrap.hpp>
0023 #include <boost/mpl/assert.hpp>
0024 #include <boost/type_traits/is_same.hpp>
0025 #endif
0026
0027 namespace boost { namespace parameter {
0028
0029
0030
0031
0032
0033 template <typename Parameters, typename Keyword, typename Default>
0034 struct binding0
0035 {
0036 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0037 using type = ::boost::mp11::mp_apply_q<
0038 typename Parameters::binding
0039 , ::boost::mp11::mp_list<Keyword,Default,::boost::mp11::mp_true>
0040 >;
0041
0042 static_assert(
0043 ::boost::mp11::mp_if<
0044 ::std::is_same<Default,::boost::parameter::void_>
0045 , ::boost::mp11::mp_if<
0046 ::std::is_same<type,::boost::parameter::void_>
0047 , ::boost::mp11::mp_false
0048 , ::boost::mp11::mp_true
0049 >
0050 , ::boost::mp11::mp_true
0051 >::value
0052 , "required parameters must not result in void_ type"
0053 );
0054 #else
0055 typedef typename ::boost::mpl::apply_wrap3<
0056 typename Parameters::binding
0057 , Keyword
0058 , Default
0059 , ::boost::mpl::true_
0060 >::type type;
0061
0062 BOOST_MPL_ASSERT((
0063 typename ::boost::mpl::eval_if<
0064 ::boost::is_same<Default,::boost::parameter::void_>
0065 , ::boost::mpl::if_<
0066 ::boost::is_same<type,::boost::parameter::void_>
0067 , ::boost::mpl::false_
0068 , ::boost::mpl::true_
0069 >
0070 , ::boost::mpl::true_
0071 >::type
0072 ));
0073 #endif
0074 };
0075
0076 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0077 template <typename Placeholder, typename Keyword, typename Default>
0078 struct binding1
0079 {
0080 using type = ::boost::mp11::mp_apply_q<
0081 Placeholder
0082 , ::boost::mp11::mp_list<Keyword,Default,::boost::mp11::mp_true>
0083 >;
0084
0085 static_assert(
0086 ::boost::mp11::mp_if<
0087 ::std::is_same<Default,::boost::parameter::void_>
0088 , ::boost::mp11::mp_if<
0089 ::std::is_same<type,::boost::parameter::void_>
0090 , ::boost::mp11::mp_false
0091 , ::boost::mp11::mp_true
0092 >
0093 , ::boost::mp11::mp_true
0094 >::value
0095 , "required parameters must not result in void_ type"
0096 );
0097 };
0098 #endif
0099 }}
0100
0101 #include <boost/parameter/aux_/is_placeholder.hpp>
0102
0103 namespace boost { namespace parameter {
0104
0105 template <
0106 typename Parameters
0107 , typename Keyword
0108 , typename Default = ::boost::parameter::void_
0109 >
0110 struct binding
0111 #if !defined(BOOST_PARAMETER_CAN_USE_MP11)
0112 : ::boost::mpl::eval_if<
0113 ::boost::parameter::aux::is_mpl_placeholder<Parameters>
0114 , ::boost::mpl::identity<int>
0115 , ::boost::parameter::binding0<Parameters,Keyword,Default>
0116 >
0117 #endif
0118 {
0119 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0120 using type = typename ::boost::mp11::mp_if<
0121 ::boost::parameter::aux::is_mpl_placeholder<Parameters>
0122 , ::boost::mp11::mp_identity<int>
0123 , ::boost::mp11::mp_if<
0124 ::boost::parameter::aux::is_mp11_placeholder<Parameters>
0125 , ::boost::parameter::binding1<Parameters,Keyword,Default>
0126 , ::boost::parameter::binding0<Parameters,Keyword,Default>
0127 >
0128 >::type;
0129 #endif
0130 };
0131 }}
0132
0133 #include <boost/parameter/aux_/result_of0.hpp>
0134
0135 namespace boost { namespace parameter {
0136
0137
0138
0139
0140 template <typename Parameters, typename Keyword, typename DefaultFn>
0141 struct lazy_binding
0142 {
0143 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0144 using type = ::boost::mp11::mp_apply_q<
0145 typename Parameters::binding
0146 , ::boost::mp11::mp_list<
0147 Keyword
0148 , typename ::boost::parameter::aux::result_of0<DefaultFn>::type
0149 , ::boost::mp11::mp_true
0150 >
0151 >;
0152 #else
0153 typedef typename ::boost::mpl::apply_wrap3<
0154 typename Parameters::binding
0155 , Keyword
0156 , typename ::boost::parameter::aux::result_of0<DefaultFn>::type
0157 , ::boost::mpl::true_
0158 >::type type;
0159 #endif
0160 };
0161 }}
0162
0163 #endif
0164