// Copyright Cromwell D. Enage 2019. // 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_COMPOSE_HPP #define BOOST_PARAMETER_COMPOSE_HPP #include namespace boost { namespace parameter { inline BOOST_CONSTEXPR ::boost::parameter::aux::empty_arg_list compose() { return ::boost::parameter::aux::empty_arg_list(); } }} // namespace boost::parameter #include #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) namespace boost { namespace parameter { namespace aux { #if defined(BOOST_PARAMETER_CAN_USE_MP11) template struct compose_arg_list { using type = ::boost::parameter::aux::flat_like_arg_list< ::boost::parameter::aux::flat_like_arg_tuple< typename TaggedArgs::base_type::key_type , typename TaggedArgs::base_type >... >; }; #else // !defined(BOOST_PARAMETER_CAN_USE_MP11) template struct compose_arg_list; template struct compose_arg_list { typedef ::boost::parameter::aux::arg_list type; }; template struct compose_arg_list { typedef ::boost::parameter::aux::arg_list< TaggedArg0 , typename ::boost::parameter::aux ::compose_arg_list::type > type; }; #endif // BOOST_PARAMETER_CAN_USE_MP11 }}} // namespace boost::parameter::aux #include #include namespace boost { namespace parameter { namespace result_of { template struct compose : ::boost::lazy_enable_if< ::boost::parameter::are_tagged_arguments , ::boost::parameter::aux::compose_arg_list > { }; template <> struct compose<> { typedef ::boost::parameter::aux::empty_arg_list type; }; }}} // namespace boost::parameter::result_of namespace boost { namespace parameter { template inline BOOST_CONSTEXPR typename ::boost::parameter::result_of ::compose::type compose(TaggedArg0 const& arg0, TaggedArgs const&... args) { return typename ::boost::parameter::aux ::compose_arg_list::type( ::boost::parameter::aux::value_type_is_not_void() , arg0 , args... ); } }} // namespace boost::parameter #else // !defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING) #define BOOST_PARAMETER_compose_arg_list_type_suffix(z, n, suffix) suffix #include #define BOOST_PARAMETER_compose_arg_list_type_prefix(z, n, prefix) \ ::boost::parameter::aux::arg_list #include #include #define BOOST_PARAMETER_compose_arg_list_type(z, n, prefix) \ BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \ n, BOOST_PARAMETER_compose_arg_list_type_prefix, prefix \ ) BOOST_PP_CAT(BOOST_PP_REPEAT_, z)( \ n, BOOST_PARAMETER_compose_arg_list_type_suffix, > \ ) /**/ #include #include #include #include #include #include #if defined(BOOST_NO_SFINAE) #define BOOST_PARAMETER_compose_arg_list_function_overload(z, n, prefix) \ template \ inline BOOST_CONSTEXPR \ BOOST_PARAMETER_compose_arg_list_type(z, n, prefix) \ compose(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, prefix, const& a)) \ { \ return BOOST_PARAMETER_compose_arg_list_type(z, n, prefix)( \ BOOST_PP_ENUM_PARAMS_Z(z, n, a) \ BOOST_PP_ENUM_TRAILING_PARAMS_Z( \ z \ , BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, n) \ , ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT \ ) \ ); \ } /**/ #else // !defined(BOOST_NO_SFINAE) #include #include namespace boost { namespace parameter { namespace result_of { template < BOOST_PP_ENUM_BINARY_PARAMS( BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY) , typename TaggedArg , = void BOOST_PP_INTERCEPT ) > struct compose; template <> struct compose<> { typedef ::boost::parameter::aux::empty_arg_list type; }; }}} // namespace boost::parameter::result_of #define BOOST_PARAMETER_compose_arg_list_function_overload(z, n, prefix) \ namespace boost { namespace parameter { namespace result_of { \ template \ struct compose \ : ::boost::enable_if< \ ::boost::parameter \ ::are_tagged_arguments \ , BOOST_PARAMETER_compose_arg_list_type(z, n, prefix) \ > \ { \ }; \ }}} \ namespace boost { namespace parameter { \ template \ inline BOOST_CONSTEXPR typename ::boost::parameter::result_of \ ::compose::type \ compose(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, prefix, const& a)) \ { \ return BOOST_PARAMETER_compose_arg_list_type(z, n, prefix)( \ BOOST_PP_ENUM_PARAMS_Z(z, n, a) \ BOOST_PP_ENUM_TRAILING_PARAMS_Z( \ z \ , BOOST_PP_SUB(BOOST_PARAMETER_COMPOSE_MAX_ARITY, n) \ , ::boost::parameter::aux::void_reference() BOOST_PP_INTERCEPT \ ) \ ); \ } \ }} /**/ #endif // BOOST_NO_SFINAE #include BOOST_PP_REPEAT_FROM_TO( 1 , BOOST_PP_INC(BOOST_PARAMETER_COMPOSE_MAX_ARITY) , BOOST_PARAMETER_compose_arg_list_function_overload , TaggedArg ) #undef BOOST_PARAMETER_compose_arg_list_function_overload #undef BOOST_PARAMETER_compose_arg_list_type #undef BOOST_PARAMETER_compose_arg_list_type_prefix #undef BOOST_PARAMETER_compose_arg_list_type_suffix #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING #endif // include guard