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