Chris@16
|
1 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
Chris@16
|
2
|
Chris@16
|
3 #include <boost/proto/detail/preprocessed/deep_copy.hpp>
|
Chris@16
|
4
|
Chris@16
|
5 #elif !defined(BOOST_PP_IS_ITERATING)
|
Chris@16
|
6
|
Chris@16
|
7 #define BOOST_PROTO_DEFINE_DEEP_COPY_TYPE(Z, N, DATA) \
|
Chris@16
|
8 typename deep_copy_impl< \
|
Chris@16
|
9 typename remove_reference< \
|
Chris@16
|
10 typename Expr::BOOST_PP_CAT(proto_child, N) \
|
Chris@16
|
11 >::type::proto_derived_expr \
|
Chris@16
|
12 >::result_type \
|
Chris@16
|
13 /**/
|
Chris@16
|
14
|
Chris@16
|
15 #define BOOST_PROTO_DEFINE_DEEP_COPY_FUN(Z, N, DATA) \
|
Chris@16
|
16 proto::deep_copy(e.proto_base().BOOST_PP_CAT(child, N)) \
|
Chris@16
|
17 /**/
|
Chris@16
|
18
|
Chris@16
|
19 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
20 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/deep_copy.hpp")
|
Chris@16
|
21 #endif
|
Chris@16
|
22
|
Chris@16
|
23 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
24 /// \file deep_copy.hpp
|
Chris@16
|
25 /// Replace all nodes stored by reference by nodes stored by value.
|
Chris@16
|
26 //
|
Chris@16
|
27 // Copyright 2008 Eric Niebler. Distributed under the Boost
|
Chris@16
|
28 // Software License, Version 1.0. (See accompanying file
|
Chris@16
|
29 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
30
|
Chris@16
|
31 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
32 #pragma wave option(preserve: 1)
|
Chris@16
|
33 #endif
|
Chris@16
|
34
|
Chris@16
|
35 #define BOOST_PP_ITERATION_PARAMS_1 \
|
Chris@16
|
36 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/deep_copy.hpp>))
|
Chris@16
|
37 #include BOOST_PP_ITERATE()
|
Chris@16
|
38
|
Chris@16
|
39 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
40 #pragma wave option(output: null)
|
Chris@16
|
41 #endif
|
Chris@16
|
42
|
Chris@16
|
43 #undef BOOST_PROTO_DEFINE_DEEP_COPY_FUN
|
Chris@16
|
44 #undef BOOST_PROTO_DEFINE_DEEP_COPY_TYPE
|
Chris@16
|
45
|
Chris@16
|
46 #else
|
Chris@16
|
47
|
Chris@16
|
48 #define N BOOST_PP_ITERATION()
|
Chris@16
|
49
|
Chris@16
|
50 template<typename Expr>
|
Chris@16
|
51 struct deep_copy_impl<Expr, N>
|
Chris@16
|
52 {
|
Chris@16
|
53 typedef
|
Chris@16
|
54 typename base_expr<
|
Chris@16
|
55 typename Expr::proto_domain
|
Chris@16
|
56 , typename Expr::proto_tag
|
Chris@16
|
57 , BOOST_PP_CAT(list, N)<
|
Chris@16
|
58 BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_TYPE, ~)
|
Chris@16
|
59 >
|
Chris@16
|
60 >::type
|
Chris@16
|
61 expr_type;
|
Chris@16
|
62
|
Chris@16
|
63 typedef typename Expr::proto_generator proto_generator;
|
Chris@16
|
64 typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
Chris@16
|
65
|
Chris@16
|
66 template<typename Expr2, typename S, typename D>
|
Chris@16
|
67 result_type operator()(Expr2 const &e, S const &, D const &) const
|
Chris@16
|
68 {
|
Chris@16
|
69 expr_type const that = {
|
Chris@16
|
70 BOOST_PP_ENUM(N, BOOST_PROTO_DEFINE_DEEP_COPY_FUN, ~)
|
Chris@16
|
71 };
|
Chris@16
|
72
|
Chris@16
|
73 return proto_generator()(that);
|
Chris@16
|
74 }
|
Chris@16
|
75 };
|
Chris@16
|
76
|
Chris@16
|
77 #undef N
|
Chris@16
|
78
|
Chris@16
|
79 #endif
|