| 1 | #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES) |
| 2 | |
| 3 | #include <boost/proto/detail/preprocessed/generate_by_value.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/generate_by_value.hpp") |
| 9 | #endif |
| 10 | |
| 11 | /////////////////////////////////////////////////////////////////////////////// |
| 12 | /// \file generate_by_value.hpp |
| 13 | /// Contains definition of by_value_generator_\<\> 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 | #define BOOST_PP_ITERATION_PARAMS_1 \ |
| 24 | (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/generate_by_value.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 // BOOST_PP_IS_ITERATING |
| 32 | |
| 33 | #define N BOOST_PP_ITERATION() |
| 34 | |
| 35 | template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename Arg) > |
| 36 | struct by_value_generator_< |
| 37 | proto::expr<Tag, BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, Arg)>, N> |
| 38 | > |
| 39 | { |
| 40 | typedef |
| 41 | BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, Arg)> |
| 42 | src_args; |
| 43 | |
| 44 | typedef |
| 45 | BOOST_PP_CAT(list, N)< |
| 46 | BOOST_PP_ENUM_BINARY_PARAMS(N, typename uncvref<Arg, >::type BOOST_PP_INTERCEPT) |
| 47 | > |
| 48 | dst_args; |
| 49 | |
| 50 | typedef proto::expr<Tag, src_args, N> src_type; |
| 51 | typedef proto::expr<Tag, dst_args, N> type; |
| 52 | |
| 53 | BOOST_FORCEINLINE |
| 54 | static type const call(src_type const &e) |
| 55 | { |
| 56 | type that = { |
| 57 | BOOST_PP_ENUM_PARAMS(N, e.child) |
| 58 | }; |
| 59 | return that; |
| 60 | } |
| 61 | }; |
| 62 | |
| 63 | template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename Arg) > |
| 64 | struct by_value_generator_< |
| 65 | proto::basic_expr<Tag, BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, Arg)>, N> |
| 66 | > |
| 67 | { |
| 68 | typedef |
| 69 | BOOST_PP_CAT(list, N)<BOOST_PP_ENUM_PARAMS(N, Arg)> |
| 70 | src_args; |
| 71 | |
| 72 | typedef |
| 73 | BOOST_PP_CAT(list, N)< |
| 74 | BOOST_PP_ENUM_BINARY_PARAMS(N, typename uncvref<Arg, >::type BOOST_PP_INTERCEPT) |
| 75 | > |
| 76 | dst_args; |
| 77 | |
| 78 | typedef proto::basic_expr<Tag, src_args, N> src_type; |
| 79 | typedef proto::basic_expr<Tag, dst_args, N> type; |
| 80 | |
| 81 | BOOST_FORCEINLINE |
| 82 | static type const call(src_type const &e) |
| 83 | { |
| 84 | type that = { |
| 85 | BOOST_PP_ENUM_PARAMS(N, e.child) |
| 86 | }; |
| 87 | return that; |
| 88 | } |
| 89 | }; |
| 90 | |
| 91 | #undef N |
| 92 | |
| 93 | #endif |
| 94 | |