123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- #ifndef BOOST_PROTO_TRANSFORM_ARG_HPP_EAN_11_01_2007
- #define BOOST_PROTO_TRANSFORM_ARG_HPP_EAN_11_01_2007
- #include <boost/mpl/if.hpp>
- #include <boost/proto/proto_fwd.hpp>
- #include <boost/proto/traits.hpp>
- #include <boost/proto/transform/impl.hpp>
- #include <boost/type_traits/is_array.hpp>
- #include <boost/proto/transform/env.hpp>
- namespace boost { namespace proto
- {
-
-
-
-
-
-
-
-
-
-
- struct _expr : transform<_expr>
- {
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
- typedef Expr result_type;
-
-
-
-
- BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::expr_param)
- operator()(
- typename impl::expr_param e
- , typename impl::state_param
- , typename impl::data_param
- ) const
- {
- return e;
- }
- };
- };
-
-
-
-
-
-
-
-
-
-
- struct _state : transform<_state>
- {
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
- typedef State result_type;
-
-
-
-
- BOOST_PROTO_RETURN_TYPE_STRICT_LOOSE(result_type, typename impl::state_param)
- operator ()(
- typename impl::expr_param
- , typename impl::state_param s
- , typename impl::data_param
- ) const
- {
- return s;
- }
- };
- };
-
-
-
-
-
-
-
-
-
-
-
- struct _data : transform<_data>
- {
- template<typename Expr, typename State, typename Data>
- struct impl
- : mpl::if_c<
- is_env<Data>::value
- , _env_var<data_type>
- , _env
- >::type::template impl<Expr, State, Data>
- {};
- };
-
-
-
-
-
-
-
-
-
-
- template<int N>
- struct _child_c : transform<_child_c<N> >
- {
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
- typedef
- typename result_of::child_c<Expr, N>::type
- result_type;
-
-
-
-
-
- #ifdef BOOST_PROTO_STRICT_RESULT_OF
- result_type
- #else
- typename result_of::child_c<typename impl::expr_param, N>::type
- #endif
- operator ()(
- typename impl::expr_param e
- , typename impl::state_param
- , typename impl::data_param
- ) const
- {
- return proto::child_c<N>(e);
- }
- };
- };
-
-
-
-
-
-
-
-
-
-
- struct _value : transform<_value>
- {
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
- typedef
- typename result_of::value<Expr>::type
- result_type;
-
-
-
-
-
- #ifdef BOOST_PROTO_STRICT_RESULT_OF
- typename mpl::if_c<is_array<result_type>::value, result_type &, result_type>::type
- #else
- typename result_of::value<typename impl::expr_param>::type
- #endif
- operator ()(
- typename impl::expr_param e
- , typename impl::state_param
- , typename impl::data_param
- ) const
- {
- return proto::value(e);
- }
- };
- };
-
-
- struct _void : transform<_void>
- {
- template<typename Expr, typename State, typename Data>
- struct impl : transform_impl<Expr, State, Data>
- {
- typedef void result_type;
-
- void operator ()(
- typename impl::expr_param
- , typename impl::state_param
- , typename impl::data_param
- ) const
- {}
- };
- };
-
-
-
-
-
-
-
-
-
-
-
- struct _byref : callable
- {
- template<typename Sig>
- struct result;
- template<typename This, typename T>
- struct result<This(T)>
- {
- typedef boost::reference_wrapper<T const> const type;
- };
- template<typename This, typename T>
- struct result<This(T &)>
- {
- typedef boost::reference_wrapper<T> const type;
- };
-
-
-
-
- template<typename T>
- boost::reference_wrapper<T> const operator ()(T &t) const
- {
- return boost::reference_wrapper<T>(t);
- }
-
-
- template<typename T>
- boost::reference_wrapper<T const> const operator ()(T const &t) const
- {
- return boost::reference_wrapper<T const>(t);
- }
- };
-
-
-
-
-
-
-
-
-
-
-
- struct _byval : callable
- {
- template<typename Sig>
- struct result;
- template<typename This, typename T>
- struct result<This(T)>
- {
- typedef T type;
- };
- template<typename This, typename T>
- struct result<This(T &)>
- : result<This(T)>
- {};
- template<typename This, typename T>
- struct result<This(boost::reference_wrapper<T>)>
- : result<This(T)>
- {};
-
-
-
- template<typename T>
- T operator ()(T const &t) const
- {
- return t;
- }
-
-
- template<typename T>
- T operator ()(boost::reference_wrapper<T> const &t) const
- {
- return t;
- }
- };
-
-
- template<>
- struct is_callable<_expr>
- : mpl::true_
- {};
-
-
- template<>
- struct is_callable<_state>
- : mpl::true_
- {};
-
-
- template<>
- struct is_callable<_data>
- : mpl::true_
- {};
-
-
- template<int N>
- struct is_callable<_child_c<N> >
- : mpl::true_
- {};
-
-
- template<>
- struct is_callable<_value>
- : mpl::true_
- {};
-
-
- template<>
- struct is_callable<_byref>
- : mpl::true_
- {};
-
-
- template<>
- struct is_callable<_byval>
- : mpl::true_
- {};
- }}
- #endif
|