PageRenderTime 27ms CodeModel.GetById 17ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/proto/transform/detail/make_gcc_workaround.hpp

http://hadesmem.googlecode.com/
C++ Header | 98 lines | 69 code | 19 blank | 10 comment | 15 complexity | 46cb8c591a0c1c3f1ad4967a9b2e4327 MD5 | raw file
 1#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
 2
 3    #if BOOST_WORKAROUND(__GNUC__, == 3) || (__GNUC__ == 4 && __GNUC_MINOR__ == 0)
 4        #include <boost/proto/transform/detail/preprocessed/make_gcc_workaround.hpp>
 5    #endif
 6
 7#elif !defined(BOOST_PP_IS_ITERATING)
 8
 9    #define BOOST_PROTO_EXPR_MAKE_ARG(Z, M, DATA)                                                   \
10        detail::as_lvalue(                                                                          \
11            typename when<_, BOOST_PP_CAT(A, M)>::template impl<Expr, State, Data>()(e, s, d)       \
12        )                                                                                           \
13        /**/
14
15    #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
16        #pragma wave option(preserve: 2, line: 0, output: "preprocessed/make_gcc_workaround.hpp")
17    #endif
18
19    ///////////////////////////////////////////////////////////////////////////////
20    /// \file make_gcc_workaround.hpp
21    /// Special workaround code to make the make\<\> transform work on certain
22    /// versions of gcc.
23    //
24    //  Copyright 2008 Eric Niebler. Distributed under the Boost
25    //  Software License, Version 1.0. (See accompanying file
26    //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
27
28    #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
29        #pragma wave option(preserve: 1)
30    #endif
31
32    #if BOOST_WORKAROUND(__GNUC__, == 3) || (__GNUC__ == 4 && __GNUC_MINOR__ == 0) ||               \
33        (defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES))
34
35        #define BOOST_PP_ITERATION_PARAMS_1                                                         \
36            (3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/make_gcc_workaround.hpp>))
37        #include BOOST_PP_ITERATE()
38
39    #endif
40
41    #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
42        #pragma wave option(output: null)
43    #endif
44
45    #undef BOOST_PROTO_EXPR_MAKE_ARG
46
47#else
48
49    #define N BOOST_PP_ITERATION()
50
51    // work around GCC bug
52    template<typename Tag, typename Args, long Arity BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
53    struct make<proto::expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))>
54      : transform<make<proto::expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> >
55    {
56        template<typename Expr, typename State, typename Data>
57        struct impl : transform_impl<Expr, State, Data>
58        {
59            typedef proto::expr<Tag, Args, Arity> result_type;
60
61            result_type operator ()(
62                typename impl::expr_param   e
63              , typename impl::state_param  s
64              , typename impl::data_param   d
65            ) const
66            {
67                return proto::expr<Tag, Args, Arity>::make(
68                    BOOST_PP_ENUM(N, BOOST_PROTO_EXPR_MAKE_ARG, DATA)
69                );
70            }
71        };
72    };
73
74    template<typename Tag, typename Args, long Arity BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
75    struct make<proto::basic_expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))>
76      : transform<make<proto::basic_expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> >
77    {
78        template<typename Expr, typename State, typename Data>
79        struct impl : transform_impl<Expr, State, Data>
80        {
81            typedef proto::basic_expr<Tag, Args, Arity> result_type;
82
83            result_type operator ()(
84                typename impl::expr_param   e
85              , typename impl::state_param  s
86              , typename impl::data_param   d
87            ) const
88            {
89                return proto::basic_expr<Tag, Args, Arity>::make(
90                    BOOST_PP_ENUM(N, BOOST_PROTO_EXPR_MAKE_ARG, DATA)
91                );
92            }
93        };
94    };
95
96    #undef N
97
98#endif