• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
2 
3     #include <boost/proto/detail/preprocessed/make_expr_.hpp>
4 
5 #elif !defined(BOOST_PP_IS_ITERATING)
6 
7     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
8         #pragma wave option(preserve: 2, line: 0, output: "preprocessed/make_expr_.hpp")
9     #endif
10 
11     ///////////////////////////////////////////////////////////////////////////////
12     /// \file make_expr_.hpp
13     /// Contains definition of make_expr_\<\> class template.
14     //
15     //  Copyright 2008 Eric Niebler. Distributed under the Boost
16     //  Software License, Version 1.0. (See accompanying file
17     //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
18 
19     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
20         #pragma wave option(preserve: 1)
21     #endif
22 
23     template<
24         typename Tag
25       , typename Domain
26         BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(
27             BOOST_PROTO_MAX_ARITY
28           , typename A
29           , = void BOOST_PP_INTERCEPT
30         )
31       , typename _ = void
32     >
33     struct make_expr_
34     {};
35 
36     template<typename Domain, typename A>
37     struct make_expr_<tag::terminal, Domain, A
38         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, void BOOST_PP_INTERCEPT)>
39     {
40         typedef typename proto::detail::protoify<A, Domain>::result_type result_type;
41 
42         BOOST_FORCEINLINE
operator ()make_expr_43         result_type operator()(typename add_reference<A>::type a) const
44         {
45             return proto::detail::protoify<A, Domain>()(a);
46         }
47     };
48 
49     template<typename A>
50     struct make_expr_<tag::terminal, deduce_domain, A
51         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, void BOOST_PP_INTERCEPT)>
52       : make_expr_<tag::terminal, default_domain, A>
53     {};
54 
55     #define BOOST_PP_ITERATION_PARAMS_1                                                         \
56         (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/make_expr_.hpp>))
57     #include BOOST_PP_ITERATE()
58 
59     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
60         #pragma wave option(output: null)
61     #endif
62 
63 #else // BOOST_PP_IS_ITERATING
64 
65     #define N BOOST_PP_ITERATION()
66     #define M BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N)
67 
68     template<typename Tag, typename Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
69     struct make_expr_<Tag, Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
70         BOOST_PP_ENUM_TRAILING_PARAMS(M, void BOOST_PP_INTERCEPT), void>
71     {
72         typedef
73             BOOST_PP_CAT(list, N)<
74                 BOOST_PP_ENUM(N, BOOST_PROTO_AS_CHILD_TYPE, (A, ~, Domain))
75             >
76         proto_args;
77 
78         typedef typename base_expr<Domain, Tag, proto_args>::type expr_type;
79         typedef typename Domain::proto_generator proto_generator;
80         typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
81 
82         BOOST_FORCEINLINE
operator ()make_expr_83         result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<A, >::type a)) const
84         {
85             expr_type const that = {
86                 BOOST_PP_ENUM(N, BOOST_PROTO_AS_CHILD, (A, a, Domain))
87             };
88             return proto_generator()(that);
89         }
90     };
91 
92     template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
93     struct make_expr_<Tag, deduce_domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
94         BOOST_PP_ENUM_TRAILING_PARAMS(M, void BOOST_PP_INTERCEPT), void>
95       : make_expr_<
96             Tag
97           , typename BOOST_PP_CAT(deduce_domain, N)<BOOST_PP_ENUM_PARAMS(N, A)>::type
98             BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
99         >
100     {};
101 
102     #undef N
103     #undef M
104 
105 #endif
106