| 1 | #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES) |
| 2 | |
| 3 | #include <boost/proto/transform/detail/preprocessed/pack_impl.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/pack_impl.hpp") |
| 9 | #endif |
| 10 | |
| 11 | /////////////////////////////////////////////////////////////////////////////// |
| 12 | /// \file pack_impl.hpp |
| 13 | /// Contains helpers for pseudo-pack expansion. |
| 14 | // |
| 15 | // Copyright 2012 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 | #define BOOST_PP_ITERATION_PARAMS_1 \ |
| 24 | (3, (0, BOOST_PP_DEC(BOOST_PROTO_MAX_ARITY), <boost/proto/transform/detail/pack_impl.hpp>)) |
| 25 | #include BOOST_PP_ITERATE() |
| 26 | |
| 27 | #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES) |
| 28 | #pragma wave option(output: null) |
| 29 | #endif |
| 30 | |
| 31 | #else |
| 32 | #if BOOST_PP_ITERATION_DEPTH() == 1 |
| 33 | #define N BOOST_PP_ITERATION() |
| 34 | #define M BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N) |
| 35 | #define M0(Z, X, D) typename expand_pattern_helper<proto::_child_c<X>, Fun>::type |
| 36 | |
| 37 | template<typename Fun, typename Cont> |
| 38 | struct expand_pattern<BOOST_PP_INC(N), Fun, Cont> |
| 39 | : Cont::template cat<BOOST_PP_ENUM(BOOST_PP_INC(N), M0, ~)> |
| 40 | { |
| 41 | BOOST_MPL_ASSERT_MSG( |
| 42 | (expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value) |
| 43 | , NO_PACK_EXPRESSION_FOUND_IN_UNPACKING_PATTERN |
| 44 | , (Fun) |
| 45 | ); |
| 46 | }; |
| 47 | |
| 48 | template<typename Ret BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> |
| 49 | struct BOOST_PP_CAT(expand_pattern_rest_, N) |
| 50 | { |
| 51 | template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_INC(M), typename C, void)> |
| 52 | struct cat; |
| 53 | |
| 54 | #define BOOST_PP_ITERATION_PARAMS_2 \ |
| 55 | (3, (1, M, <boost/proto/transform/detail/pack_impl.hpp>)) |
| 56 | #include BOOST_PP_ITERATE() |
| 57 | }; |
| 58 | #undef M0 |
| 59 | #undef M |
| 60 | #undef N |
| 61 | #else |
| 62 | #define I BOOST_PP_ITERATION() |
| 63 | #define J BOOST_PP_RELATIVE_ITERATION(1) |
| 64 | template<BOOST_PP_ENUM_PARAMS(I, typename C)> |
| 65 | struct cat<BOOST_PP_ENUM_PARAMS(I, C)> |
| 66 | { |
| 67 | typedef msvc_fun_workaround<Ret(BOOST_PP_ENUM_PARAMS(J, A) BOOST_PP_COMMA_IF(J) BOOST_PP_ENUM_PARAMS(I, C))> type; |
| 68 | }; |
| 69 | #undef J |
| 70 | #undef I |
| 71 | #endif |
| 72 | #endif |
| 73 | |