Files
externals/linux/include/ActivBoost/parameter/compose.hpp
T
2023-12-15 13:15:08 -05:00

211 lines
8.7 KiB
C++

// 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 ACTIV_BOOST_PARAMETER_COMPOSE_HPP
#define ACTIV_BOOST_PARAMETER_COMPOSE_HPP
#include <ActivBoost/parameter/aux_/arg_list.hpp>
namespace Boost { namespace parameter {
inline ACTIV_BOOST_CONSTEXPR ::Boost::parameter::aux::empty_arg_list compose()
{
return ::Boost::parameter::aux::empty_arg_list();
}
}} // namespace Boost::parameter
#include <ActivBoost/parameter/config.hpp>
#if defined(ACTIV_BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
namespace Boost { namespace parameter { namespace aux {
#if defined(ACTIV_BOOST_PARAMETER_CAN_USE_MP11)
template <typename ...TaggedArgs>
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(ACTIV_BOOST_PARAMETER_CAN_USE_MP11)
template <typename TaggedArg0, typename ...TaggedArgs>
struct compose_arg_list;
template <typename TaggedArg0>
struct compose_arg_list<TaggedArg0>
{
typedef ::Boost::parameter::aux::arg_list<TaggedArg0> type;
};
template <typename TaggedArg0, typename ...TaggedArgs>
struct compose_arg_list
{
typedef ::Boost::parameter::aux::arg_list<
TaggedArg0
, typename ::Boost::parameter::aux
::compose_arg_list<TaggedArgs...>::type
> type;
};
#endif // ACTIV_BOOST_PARAMETER_CAN_USE_MP11
}}} // namespace Boost::parameter::aux
#include <ActivBoost/parameter/are_tagged_arguments.hpp>
#include <ActivBoost/core/enable_if.hpp>
namespace Boost { namespace parameter { namespace result_of {
template <typename ...TaggedArgs>
struct compose
: ::Boost::lazy_enable_if<
::Boost::parameter::are_tagged_arguments<TaggedArgs...>
, ::Boost::parameter::aux::compose_arg_list<TaggedArgs...>
>
{
};
template <>
struct compose<>
{
typedef ::Boost::parameter::aux::empty_arg_list type;
};
}}} // namespace Boost::parameter::result_of
namespace Boost { namespace parameter {
template <typename TaggedArg0, typename ...TaggedArgs>
inline ACTIV_BOOST_CONSTEXPR typename ::Boost::parameter::result_of
::compose<TaggedArg0,TaggedArgs...>::type
compose(TaggedArg0 const& arg0, TaggedArgs const&... args)
{
return typename ::Boost::parameter::aux
::compose_arg_list<TaggedArg0,TaggedArgs...>::type(
::Boost::parameter::aux::value_type_is_not_void()
, arg0
, args...
);
}
}} // namespace Boost::parameter
#else // !defined(ACTIV_BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
#define ACTIV_BOOST_PARAMETER_compose_arg_list_type_suffix(z, n, suffix) suffix
#include <ActivBoost/preprocessor/cat.hpp>
#define ACTIV_BOOST_PARAMETER_compose_arg_list_type_prefix(z, n, prefix) \
::Boost::parameter::aux::arg_list<ACTIV_BOOST_PP_CAT(prefix, n)
/**/
#include <ActivBoost/preprocessor/facilities/intercept.hpp>
#include <ActivBoost/preprocessor/repetition/enum.hpp>
#include <ActivBoost/preprocessor/repetition/repeat.hpp>
#define ACTIV_BOOST_PARAMETER_compose_arg_list_type(z, n, prefix) \
ACTIV_BOOST_PP_CAT(ACTIV_BOOST_PP_ENUM_, z)( \
n, ACTIV_BOOST_PARAMETER_compose_arg_list_type_prefix, prefix \
) ACTIV_BOOST_PP_CAT(ACTIV_BOOST_PP_REPEAT_, z)( \
n, ACTIV_BOOST_PARAMETER_compose_arg_list_type_suffix, > \
)
/**/
#include <ActivBoost/parameter/aux_/void.hpp>
#include <ActivBoost/preprocessor/arithmetic/inc.hpp>
#include <ActivBoost/preprocessor/arithmetic/sub.hpp>
#include <ActivBoost/preprocessor/repetition/enum_params.hpp>
#include <ActivBoost/preprocessor/repetition/enum_binary_params.hpp>
#include <ActivBoost/preprocessor/repetition/enum_trailing_params.hpp>
#if defined(ACTIV_BOOST_NO_SFINAE)
#define ACTIV_BOOST_PARAMETER_compose_arg_list_function_overload(z, n, prefix) \
template <ACTIV_BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)> \
inline ACTIV_BOOST_CONSTEXPR \
ACTIV_BOOST_PARAMETER_compose_arg_list_type(z, n, prefix) \
compose(ACTIV_BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, prefix, const& a)) \
{ \
return ACTIV_BOOST_PARAMETER_compose_arg_list_type(z, n, prefix)( \
ACTIV_BOOST_PP_ENUM_PARAMS_Z(z, n, a) \
ACTIV_BOOST_PP_ENUM_TRAILING_PARAMS_Z( \
z \
, ACTIV_BOOST_PP_SUB(ACTIV_BOOST_PARAMETER_COMPOSE_MAX_ARITY, n) \
, ::Boost::parameter::aux::void_reference() ACTIV_BOOST_PP_INTERCEPT \
) \
); \
}
/**/
#else // !defined(ACTIV_BOOST_NO_SFINAE)
#include <ActivBoost/parameter/are_tagged_arguments.hpp>
#include <ActivBoost/core/enable_if.hpp>
namespace Boost { namespace parameter { namespace result_of {
template <
ACTIV_BOOST_PP_ENUM_BINARY_PARAMS(
ACTIV_BOOST_PP_INC(ACTIV_BOOST_PARAMETER_COMPOSE_MAX_ARITY)
, typename TaggedArg
, = void ACTIV_BOOST_PP_INTERCEPT
)
>
struct compose;
template <>
struct compose<>
{
typedef ::Boost::parameter::aux::empty_arg_list type;
};
}}} // namespace Boost::parameter::result_of
#define ACTIV_BOOST_PARAMETER_compose_arg_list_function_overload(z, n, prefix) \
namespace Boost { namespace parameter { namespace result_of { \
template <ACTIV_BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)> \
struct compose<ACTIV_BOOST_PP_ENUM_PARAMS_Z(z, n, prefix)> \
: ::Boost::enable_if< \
::Boost::parameter \
::are_tagged_arguments<ACTIV_BOOST_PP_ENUM_PARAMS_Z(z, n, prefix)> \
, ACTIV_BOOST_PARAMETER_compose_arg_list_type(z, n, prefix) \
> \
{ \
}; \
}}} \
namespace Boost { namespace parameter { \
template <ACTIV_BOOST_PP_ENUM_PARAMS_Z(z, n, typename prefix)> \
inline ACTIV_BOOST_CONSTEXPR typename ::Boost::parameter::result_of \
::compose<ACTIV_BOOST_PP_ENUM_PARAMS_Z(z, n, prefix)>::type \
compose(ACTIV_BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, prefix, const& a)) \
{ \
return ACTIV_BOOST_PARAMETER_compose_arg_list_type(z, n, prefix)( \
ACTIV_BOOST_PP_ENUM_PARAMS_Z(z, n, a) \
ACTIV_BOOST_PP_ENUM_TRAILING_PARAMS_Z( \
z \
, ACTIV_BOOST_PP_SUB(ACTIV_BOOST_PARAMETER_COMPOSE_MAX_ARITY, n) \
, ::Boost::parameter::aux::void_reference() ACTIV_BOOST_PP_INTERCEPT \
) \
); \
} \
}}
/**/
#endif // ACTIV_BOOST_NO_SFINAE
#include <ActivBoost/preprocessor/repetition/repeat_from_to.hpp>
ACTIV_BOOST_PP_REPEAT_FROM_TO(
1
, ACTIV_BOOST_PP_INC(ACTIV_BOOST_PARAMETER_COMPOSE_MAX_ARITY)
, ACTIV_BOOST_PARAMETER_compose_arg_list_function_overload
, TaggedArg
)
#undef ACTIV_BOOST_PARAMETER_compose_arg_list_function_overload
#undef ACTIV_BOOST_PARAMETER_compose_arg_list_type
#undef ACTIV_BOOST_PARAMETER_compose_arg_list_type_prefix
#undef ACTIV_BOOST_PARAMETER_compose_arg_list_type_suffix
#endif // ACTIV_BOOST_PARAMETER_HAS_PERFECT_FORWARDING
#endif // include guard