123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- #ifndef BOOST_PROTO_DEEP_COPY_HPP_EAN_11_21_2006
- #define BOOST_PROTO_DEEP_COPY_HPP_EAN_11_21_2006
- #include <boost/preprocessor/cat.hpp>
- #include <boost/preprocessor/repetition/enum.hpp>
- #include <boost/preprocessor/iteration/iterate.hpp>
- #include <boost/mpl/if.hpp>
- #include <boost/type_traits/remove_reference.hpp>
- #include <boost/proto/proto_fwd.hpp>
- #include <boost/proto/args.hpp>
- #include <boost/proto/expr.hpp>
- namespace boost { namespace proto
- {
- namespace detail
- {
- template<typename Expr, long Arity = Expr::proto_arity_c>
- struct deep_copy_impl;
- template<typename Expr>
- struct deep_copy_impl<Expr, 0>
- {
- typedef
- typename base_expr<
- typename Expr::proto_domain
- , tag::terminal
- , term<typename term_traits<typename Expr::proto_child0>::value_type>
- >::type
- expr_type;
- typedef typename Expr::proto_generator proto_generator;
- typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
- template<typename Expr2, typename S, typename D>
- result_type operator()(Expr2 const &e, S const &, D const &) const
- {
- return proto_generator()(expr_type::make(e.proto_base().child0));
- }
- };
- }
- namespace result_of
- {
-
-
-
-
-
-
-
-
- template<typename Expr>
- struct deep_copy
- {
- typedef
- typename detail::deep_copy_impl<
- BOOST_PROTO_UNCVREF(Expr)
- >::result_type
- type;
- };
- }
- namespace functional
- {
-
-
-
-
-
-
-
-
-
-
-
-
- struct deep_copy
- {
- BOOST_PROTO_CALLABLE()
- template<typename Sig>
- struct result;
- template<typename This, typename Expr>
- struct result<This(Expr)>
- {
- typedef
- typename detail::deep_copy_impl<
- BOOST_PROTO_UNCVREF(Expr)
- >::result_type
- type;
- };
-
-
-
- template<typename Expr>
- typename result_of::deep_copy<Expr>::type
- operator()(Expr const &e) const
- {
- return proto::detail::deep_copy_impl<Expr>()(e, 0, 0);
- }
- };
- }
-
-
-
-
-
-
-
-
-
-
-
-
- template<typename Expr>
- typename proto::result_of::deep_copy<Expr>::type
- deep_copy(Expr const &e)
- {
- return proto::detail::deep_copy_impl<Expr>()(e, 0, 0);
- }
-
-
-
-
-
-
-
-
-
-
-
-
- struct _deep_copy
- : proto::transform<_deep_copy>
- {
- template<typename E, typename S, typename D>
- struct impl
- : detail::deep_copy_impl<BOOST_PROTO_UNCVREF(E)>
- {};
- };
- namespace detail
- {
-
- #include <boost/proto/detail/deep_copy.hpp>
- }
- }}
- #endif
|