// Copyright David Abrahams 2005. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PARAMETER_BINDING_DWA200558_HPP #define BOOST_PARAMETER_BINDING_DWA200558_HPP #include #include #if defined(BOOST_PARAMETER_CAN_USE_MP11) #include #include #include #include #else #include #include #include #include #include #include #include #endif namespace boost { namespace parameter { // A metafunction that, given an argument pack, returns the reference type // of the parameter identified by the given keyword. If no such parameter // has been specified, returns Default template struct binding0 { #if defined(BOOST_PARAMETER_CAN_USE_MP11) using type = ::boost::mp11::mp_apply_q< typename Parameters::binding , ::boost::mp11::mp_list >; static_assert( ::boost::mp11::mp_if< ::std::is_same , ::boost::mp11::mp_if< ::std::is_same , ::boost::mp11::mp_false , ::boost::mp11::mp_true > , ::boost::mp11::mp_true >::value , "required parameters must not result in void_ type" ); #else // !defined(BOOST_PARAMETER_CAN_USE_MP11) typedef typename ::boost::mpl::apply_wrap3< typename Parameters::binding , Keyword , Default , ::boost::mpl::true_ >::type type; BOOST_MPL_ASSERT(( typename ::boost::mpl::eval_if< ::boost::is_same , ::boost::mpl::if_< ::boost::is_same , ::boost::mpl::false_ , ::boost::mpl::true_ > , ::boost::mpl::true_ >::type )); #endif // BOOST_PARAMETER_CAN_USE_MP11 }; #if defined(BOOST_PARAMETER_CAN_USE_MP11) template struct binding1 { using type = ::boost::mp11::mp_apply_q< Placeholder , ::boost::mp11::mp_list >; static_assert( ::boost::mp11::mp_if< ::std::is_same , ::boost::mp11::mp_if< ::std::is_same , ::boost::mp11::mp_false , ::boost::mp11::mp_true > , ::boost::mp11::mp_true >::value , "required parameters must not result in void_ type" ); }; #endif // BOOST_PARAMETER_CAN_USE_MP11 }} // namespace boost::parameter #include namespace boost { namespace parameter { template < typename Parameters , typename Keyword , typename Default = ::boost::parameter::void_ > struct binding #if !defined(BOOST_PARAMETER_CAN_USE_MP11) : ::boost::mpl::eval_if< ::boost::parameter::aux::is_mpl_placeholder , ::boost::mpl::identity , ::boost::parameter::binding0 > #endif { #if defined(BOOST_PARAMETER_CAN_USE_MP11) using type = typename ::boost::mp11::mp_if< ::boost::parameter::aux::is_mpl_placeholder , ::boost::mp11::mp_identity , ::boost::mp11::mp_if< ::boost::parameter::aux::is_mp11_placeholder , ::boost::parameter::binding1 , ::boost::parameter::binding0 > >::type; #endif }; }} // namespace boost::parameter #include namespace boost { namespace parameter { // A metafunction that, given an argument pack, returns the reference type // of the parameter identified by the given keyword. If no such parameter // has been specified, returns the type returned by invoking DefaultFn template struct lazy_binding { #if defined(BOOST_PARAMETER_CAN_USE_MP11) using type = ::boost::mp11::mp_apply_q< typename Parameters::binding , ::boost::mp11::mp_list< Keyword , typename ::boost::parameter::aux::result_of0::type , ::boost::mp11::mp_true > >; #else typedef typename ::boost::mpl::apply_wrap3< typename Parameters::binding , Keyword , typename ::boost::parameter::aux::result_of0::type , ::boost::mpl::true_ >::type type; #endif // BOOST_PARAMETER_CAN_USE_MP11 }; }} // namespace boost::parameter #endif // include guard