Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:31

0001 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
0002 
0003     #include <boost/proto/transform/detail/preprocessed/make.hpp>
0004 
0005 #elif !defined(BOOST_PP_IS_ITERATING)
0006 
0007     #define BOOST_PROTO_MAKE_IF(Z, M, DATA)                                                         \
0008         make_if_<BOOST_PP_CAT(A, M), Expr, State, Data>                                             \
0009         /**/
0010 
0011     #define BOOST_PROTO_MAKE_IF_TYPE(Z, M, DATA)                                                    \
0012         typename BOOST_PROTO_MAKE_IF(Z, M, DATA) ::type                                             \
0013         /**/
0014 
0015     #define BOOST_PROTO_MAKE_IF_APPLIED(Z, M, DATA)                                                 \
0016         BOOST_PROTO_MAKE_IF(Z, M, DATA) ::applied ||                                                \
0017         /**/
0018 
0019     #define BOOST_PROTO_CONSTRUCT_ARG(Z, M, DATA)                                                   \
0020         detail::as_lvalue(                                                                          \
0021             typename when<_, BOOST_PP_CAT(A, M)>::template impl<Expr, State, Data>()(e, s, d)       \
0022         )                                                                                           \
0023         /**/
0024 
0025     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0026         #pragma wave option(preserve: 2, line: 0, output: "preprocessed/make.hpp")
0027     #endif
0028 
0029     ///////////////////////////////////////////////////////////////////////////////
0030     /// \file make.hpp
0031     /// Contains definition of the make<> transform.
0032     //
0033     //  Copyright 2008 Eric Niebler. Distributed under the Boost
0034     //  Software License, Version 1.0. (See accompanying file
0035     //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0036 
0037     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0038         #pragma wave option(preserve: 1)
0039     #endif
0040 
0041     #define BOOST_PP_ITERATION_PARAMS_1                                                             \
0042         (3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/make.hpp>))
0043     #include BOOST_PP_ITERATE()
0044 
0045     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0046         #pragma wave option(output: null)
0047     #endif
0048 
0049     #undef BOOST_PROTO_CONSTRUCT_ARG
0050     #undef BOOST_PROTO_MAKE_IF_APPLIED
0051     #undef BOOST_PROTO_MAKE_IF_TYPE
0052     #undef BOOST_PROTO_MAKE_IF
0053 
0054 #else
0055 
0056     #define N BOOST_PP_ITERATION()
0057 
0058     namespace detail
0059     {
0060         #if N > 0
0061 
0062         template<
0063             template<BOOST_PP_ENUM_PARAMS(N, typename BOOST_PP_INTERCEPT)> class R
0064             BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)
0065           , typename Expr, typename State, typename Data
0066         >
0067         struct make_<
0068             R<BOOST_PP_ENUM_PARAMS(N, A)>
0069           , Expr, State, Data
0070             BOOST_PROTO_TEMPLATE_ARITY_PARAM(N)
0071         >
0072           : nested_type_if<
0073                 R<BOOST_PP_ENUM(N, BOOST_PROTO_MAKE_IF_TYPE, ~)>
0074               , (BOOST_PP_REPEAT(N, BOOST_PROTO_MAKE_IF_APPLIED, ~) false)
0075             >
0076         {};
0077 
0078         template<
0079             template<BOOST_PP_ENUM_PARAMS(N, typename BOOST_PP_INTERCEPT)> class R
0080             BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)
0081           , typename Expr, typename State, typename Data
0082         >
0083         struct make_<
0084             noinvoke<R<BOOST_PP_ENUM_PARAMS(N, A)> >
0085           , Expr, State, Data
0086             BOOST_PROTO_TEMPLATE_ARITY_PARAM(1)
0087         >
0088         {
0089             typedef R<BOOST_PP_ENUM(N, BOOST_PROTO_MAKE_IF_TYPE, ~)> type;
0090             static bool const applied = true;
0091         };
0092 
0093         #endif
0094 
0095         template<typename R BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
0096         struct is_applyable<R(BOOST_PP_ENUM_PARAMS(N, A))>
0097           : mpl::true_
0098         {};
0099 
0100         template<typename R BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
0101         struct is_applyable<R(*)(BOOST_PP_ENUM_PARAMS(N, A))>
0102           : mpl::true_
0103         {};
0104 
0105         template<typename T, typename A>
0106         struct construct_<proto::expr<T, A, N>, true>
0107         {
0108             typedef proto::expr<T, A, N> result_type;
0109 
0110             template<BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), typename A)>
0111             BOOST_FORCEINLINE
0112             result_type operator ()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_MAX(N, 1), A, &a)) const
0113             {
0114                 return result_type::make(BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), a));
0115             }
0116         };
0117 
0118         template<typename T, typename A>
0119         struct construct_<proto::basic_expr<T, A, N>, true>
0120         {
0121             typedef proto::basic_expr<T, A, N> result_type;
0122 
0123             template<BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), typename A)>
0124             BOOST_FORCEINLINE
0125             result_type operator ()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_MAX(N, 1), A, &a)) const
0126             {
0127                 return result_type::make(BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), a));
0128             }
0129         };
0130 
0131         template<typename Type BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
0132         BOOST_FORCEINLINE
0133         Type construct(BOOST_PP_ENUM_BINARY_PARAMS(N, A, &a))
0134         {
0135             return construct_<Type>()(BOOST_PP_ENUM_PARAMS(N, a));
0136         }
0137 
0138     } // namespace detail
0139 
0140     /// \brief A PrimitiveTransform which computes a type by evaluating any
0141     /// nested transforms and then constructs an object of that type with the
0142     /// current expression, state and data, transformed according
0143     /// to \c A0 through \c AN.
0144     template<typename Object BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
0145     struct make<Object(BOOST_PP_ENUM_PARAMS(N, A))>
0146       : transform<make<Object(BOOST_PP_ENUM_PARAMS(N, A))> >
0147     {
0148         template<typename Expr, typename State, typename Data>
0149         struct impl : transform_impl<Expr, State, Data>
0150         {
0151             /// \brief <tt>boost::result_of\<make\<Object\>(Expr, State, Data)\>::type</tt>
0152             typedef typename detail::make_if_<Object, Expr, State, Data>::type result_type;
0153 
0154             /// Let \c ax be <tt>when\<_, Ax\>()(e, s, d)</tt>
0155             /// for each \c x in <tt>[0,N]</tt>.
0156             /// Return <tt>result_type(a0, a1,... aN)</tt>.
0157             ///
0158             /// \param e The current expression
0159             /// \param s The current state
0160             /// \param d An arbitrary data
0161             BOOST_FORCEINLINE
0162             result_type operator ()(
0163                 typename impl::expr_param   e
0164               , typename impl::state_param  s
0165               , typename impl::data_param   d
0166             ) const
0167             {
0168                 proto::detail::ignore_unused(e);
0169                 proto::detail::ignore_unused(s);
0170                 proto::detail::ignore_unused(d);
0171                 return detail::construct<result_type>(BOOST_PP_ENUM(N, BOOST_PROTO_CONSTRUCT_ARG, DATA));
0172             }
0173         };
0174     };
0175 
0176     #if N > 0
0177     /// \brief A PrimitiveTransform which computes a type by evaluating any
0178     /// nested transforms and then constructs an object of that type with the
0179     /// current expression, state and data, transformed according
0180     /// to \c A0 through \c AN.
0181     template<typename Object BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
0182     struct make<Object(BOOST_PP_ENUM_PARAMS(N, A)...)>
0183       : transform<make<Object(BOOST_PP_ENUM_PARAMS(N, A)...)> >
0184     {
0185         template<typename Expr, typename State, typename Data>
0186         struct impl
0187           : make<
0188                 typename detail::expand_pattern<
0189                     proto::arity_of<Expr>::value
0190                   , BOOST_PP_CAT(A, BOOST_PP_DEC(N))
0191                   , detail::BOOST_PP_CAT(expand_pattern_rest_, BOOST_PP_DEC(N))<
0192                         Object
0193                         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_DEC(N), A)
0194                     >
0195                 >::type
0196             >::template impl<Expr, State, Data>
0197         {};
0198     };
0199     #endif
0200     #undef N
0201 
0202 #endif