Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
0002 
0003     #include <boost/proto/detail/preprocessed/make_expr_.hpp>
0004 
0005 #elif !defined(BOOST_PP_IS_ITERATING)
0006 
0007     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0008         #pragma wave option(preserve: 2, line: 0, output: "preprocessed/make_expr_.hpp")
0009     #endif
0010 
0011     ///////////////////////////////////////////////////////////////////////////////
0012     /// \file make_expr_.hpp
0013     /// Contains definition of make_expr_\<\> class template.
0014     //
0015     //  Copyright 2008 Eric Niebler. Distributed under the Boost
0016     //  Software License, Version 1.0. (See accompanying file
0017     //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0018 
0019     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0020         #pragma wave option(preserve: 1)
0021     #endif
0022 
0023     template<
0024         typename Tag
0025       , typename Domain
0026         BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
0027             BOOST_PROTO_MAX_ARITY
0028           , typename A
0029           , = void BOOST_PP_INTERCEPT
0030         )
0031       , typename _ = void
0032     >
0033     struct make_expr_
0034     {};
0035 
0036     template<typename Domain, typename A>
0037     struct make_expr_<tag::terminal, Domain, A
0038         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, void BOOST_PP_INTERCEPT)>
0039     {
0040         typedef typename proto::detail::protoify<A, Domain>::result_type result_type;
0041 
0042         BOOST_FORCEINLINE
0043         result_type operator()(typename add_reference<A>::type a) const
0044         {
0045             return proto::detail::protoify<A, Domain>()(a);
0046         }
0047     };
0048 
0049     template<typename A>
0050     struct make_expr_<tag::terminal, deduce_domain, A
0051         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, void BOOST_PP_INTERCEPT)>
0052       : make_expr_<tag::terminal, default_domain, A>
0053     {};
0054 
0055     #define BOOST_PP_ITERATION_PARAMS_1                                                         \
0056         (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/make_expr_.hpp>))
0057     #include BOOST_PP_ITERATE()
0058 
0059     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0060         #pragma wave option(output: null)
0061     #endif
0062 
0063 #else // BOOST_PP_IS_ITERATING
0064 
0065     #define N BOOST_PP_ITERATION()
0066     #define M BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N)
0067 
0068     template<typename Tag, typename Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
0069     struct make_expr_<Tag, Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
0070         BOOST_PP_ENUM_TRAILING_PARAMS(M, void BOOST_PP_INTERCEPT), void>
0071     {
0072         typedef
0073             BOOST_PP_CAT(list, N)<
0074                 BOOST_PP_ENUM(N, BOOST_PROTO_AS_CHILD_TYPE, (A, ~, Domain))
0075             >
0076         proto_args;
0077 
0078         typedef typename base_expr<Domain, Tag, proto_args>::type expr_type;
0079         typedef typename Domain::proto_generator proto_generator;
0080         typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
0081 
0082         BOOST_FORCEINLINE
0083         result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<A, >::type a)) const
0084         {
0085             expr_type const that = {
0086                 BOOST_PP_ENUM(N, BOOST_PROTO_AS_CHILD, (A, a, Domain))
0087             };
0088             return proto_generator()(that);
0089         }
0090     };
0091 
0092     template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
0093     struct make_expr_<Tag, deduce_domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
0094         BOOST_PP_ENUM_TRAILING_PARAMS(M, void BOOST_PP_INTERCEPT), void>
0095       : make_expr_<
0096             Tag
0097           , typename BOOST_PP_CAT(deduce_domain, N)<BOOST_PP_ENUM_PARAMS(N, A)>::type
0098             BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
0099         >
0100     {};
0101 
0102     #undef N
0103     #undef M
0104 
0105 #endif