• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
2 
3     #include <boost/proto/transform/detail/preprocessed/pass_through_impl.hpp>
4 
5 #elif !defined(BOOST_PP_IS_ITERATING)
6 
7     #define BOOST_PROTO_DEFINE_TRANSFORM_TYPE(Z, N, DATA)                                   \
8         typename Grammar::BOOST_PP_CAT(proto_child, N)::template impl<                      \
9             typename result_of::child_c<Expr, N>::type                                      \
10           , State                                                                           \
11           , Data                                                                            \
12         >::result_type                                                                      \
13         /**/
14 
15     #define BOOST_PROTO_DEFINE_TRANSFORM(Z, N, DATA)                                        \
16         typename Grammar::BOOST_PP_CAT(proto_child, N)::template impl<                      \
17             typename result_of::child_c<Expr, N>::type                                      \
18           , State                                                                           \
19           , Data                                                                            \
20         >()(                                                                                \
21             e.proto_base().BOOST_PP_CAT(child, N), s, d                                     \
22         )                                                                                   \
23         /**/
24 
25     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
26         #pragma wave option(preserve: 2, line: 0, output: "preprocessed/pass_through_impl.hpp")
27     #endif
28 
29     ///////////////////////////////////////////////////////////////////////////////
30     /// \file pass_through_impl.hpp
31     ///
32     /// Specializations of pass_through_impl, used in the implementation of the
33     /// pass_through transform.
34     //
35     //  Copyright 2008 Eric Niebler. Distributed under the Boost
36     //  Software License, Version 1.0. (See accompanying file
37     //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
38 
39     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
40         #pragma wave option(preserve: 1)
41     #endif
42 
43     #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/pass_through_impl.hpp>))
44     #include BOOST_PP_ITERATE()
45 
46     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
47         #pragma wave option(output: null)
48     #endif
49 
50     #undef BOOST_PROTO_DEFINE_TRANSFORM
51     #undef BOOST_PROTO_DEFINE_TRANSFORM_TYPE
52 
53 #else
54 
55     #define N BOOST_PP_ITERATION()
56 
57     template<typename Grammar, typename Domain, typename Expr, typename State, typename Data>
58     struct pass_through_impl<Grammar, Domain, Expr, State, Data, N>
59       : transform_impl<Expr, State, Data>
60     {
61         typedef typename pass_through_impl::expr unref_expr;
62         typedef
63             typename mpl::if_c<
64                 is_same<Domain, deduce_domain>::value
65               , typename unref_expr::proto_domain
66               , Domain
67             >::type
68         result_domain;
69 
70         typedef
71             typename base_expr<
72                 result_domain
73               , typename unref_expr::proto_tag
74               , BOOST_PP_CAT(list, N)<
75                     BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_TRANSFORM_TYPE, ~)
76                 >
77             >::type
78         expr_type;
79 
80         typedef typename result_domain::proto_generator proto_generator;
81         typedef typename BOOST_PROTO_RESULT_OF<proto_generator(expr_type)>::type result_type;
82 
83         BOOST_FORCEINLINE
BOOST_PROTO_RETURN_TYPE_STRICT_LOOSEpass_through_impl84         BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, result_type const)
85         operator ()(
86             typename pass_through_impl::expr_param e
87           , typename pass_through_impl::state_param s
88           , typename pass_through_impl::data_param d
89         ) const
90         {
91             expr_type const that = {
92                 BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_TRANSFORM, ~)
93             };
94             // Without this, MSVC complains that "that" is uninitialized,
95             // and it actually triggers a runtime check in debug mode when
96             // built with VC8.
97             detail::ignore_unused(&that);
98             return proto_generator()(that);
99         }
100     };
101 
102     #undef N
103 
104 #endif
105