123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401 |
- #ifndef BOOST_PROTO_TRANSFORM_CALL_HPP_EAN_11_02_2007
- #define BOOST_PROTO_TRANSFORM_CALL_HPP_EAN_11_02_2007
- #if defined(_MSC_VER)
- # pragma warning(push)
- # pragma warning(disable: 4714)
- #endif
- #include <boost/preprocessor/cat.hpp>
- #include <boost/preprocessor/facilities/intercept.hpp>
- #include <boost/preprocessor/iteration/iterate.hpp>
- #include <boost/preprocessor/repetition/enum.hpp>
- #include <boost/preprocessor/repetition/repeat.hpp>
- #include <boost/preprocessor/repetition/enum_params.hpp>
- #include <boost/preprocessor/repetition/enum_binary_params.hpp>
- #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
- #include <boost/ref.hpp>
- #include <boost/utility/result_of.hpp>
- #include <boost/proto/proto_fwd.hpp>
- #include <boost/proto/traits.hpp>
- #include <boost/proto/transform/impl.hpp>
- #include <boost/proto/detail/as_lvalue.hpp>
- #include <boost/proto/detail/poly_function.hpp>
- #include <boost/proto/transform/detail/pack.hpp>
- namespace boost { namespace proto
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- template<typename PrimitiveTransform>
- struct call
- : PrimitiveTransform
- {};
-
-
-
-
-
-
-
-
-
-
-
-
- template<typename Fun>
- struct call<Fun *>
- : call<Fun>
- {};
-
- template<typename Fun>
- struct call<detail::msvc_fun_workaround<Fun> >
- : call<Fun>
- {};
-
-
-
- template<typename Fun>
- struct call<Fun()> : transform<call<Fun()> >
- {
-
- template<typename Expr, typename State, typename Data, bool B>
- struct impl2
- : transform_impl<Expr, State, Data>
- {
- typedef typename BOOST_PROTO_RESULT_OF<Fun()>::type result_type;
- BOOST_FORCEINLINE
- result_type operator()(
- typename impl2::expr_param
- , typename impl2::state_param
- , typename impl2::data_param
- ) const
- {
- return Fun()();
- }
- };
-
- template<typename Expr, typename State, typename Data>
- struct impl2<Expr, State, Data, true>
- : Fun::template impl<Expr, State, Data>
- {};
-
-
-
-
-
-
-
-
-
-
-
-
-
- template<typename Expr, typename State, typename Data>
- struct impl
- : impl2<Expr, State, Data, detail::is_transform_<Fun>::value>
- {};
- };
-
-
-
- template<typename Fun, typename A0>
- struct call<Fun(A0)> : transform<call<Fun(A0)> >
- {
- template<typename Expr, typename State, typename Data, bool B>
- struct impl2
- : transform_impl<Expr, State, Data>
- {
- typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
- typedef typename detail::poly_function_traits<Fun, Fun(a0)>::result_type result_type;
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
- ) const
- {
- return typename detail::poly_function_traits<Fun, Fun(a0)>::function_type()(
- detail::as_lvalue(typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d))
- );
- }
- };
- template<typename Expr, typename State, typename Data>
- struct impl2<Expr, State, Data, true>
- : transform_impl<Expr, State, Data>
- {
- typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
- typedef typename Fun::template impl<a0, State, Data>::result_type result_type;
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
- ) const
- {
- return typename Fun::template impl<a0, State, Data>()(
- typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d)
- , s
- , d
- );
- }
- };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- template<typename Expr, typename State, typename Data>
- struct impl
- : impl2<Expr, State, Data, detail::is_transform_<Fun>::value>
- {};
- };
-
-
-
- template<typename Fun, typename A0, typename A1>
- struct call<Fun(A0, A1)> : transform<call<Fun(A0, A1)> >
- {
- template<typename Expr, typename State, typename Data, bool B>
- struct impl2
- : transform_impl<Expr, State, Data>
- {
- typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
- typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;
- typedef typename detail::poly_function_traits<Fun, Fun(a0, a1)>::result_type result_type;
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
- ) const
- {
- return typename detail::poly_function_traits<Fun, Fun(a0, a1)>::function_type()(
- detail::as_lvalue(typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d))
- , detail::as_lvalue(typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d))
- );
- }
- };
- template<typename Expr, typename State, typename Data>
- struct impl2<Expr, State, Data, true>
- : transform_impl<Expr, State, Data>
- {
- typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
- typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;
- typedef typename Fun::template impl<a0, a1, Data>::result_type result_type;
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
- ) const
- {
- return typename Fun::template impl<a0, a1, Data>()(
- typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d)
- , typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d)
- , d
- );
- }
- };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- template<typename Expr, typename State, typename Data>
- struct impl
- : impl2<Expr, State, Data, detail::is_transform_<Fun>::value>
- {};
- };
-
-
-
-
- template<typename Fun, typename A0, typename A1, typename A2>
- struct call<Fun(A0, A1, A2)> : transform<call<Fun(A0, A1, A2)> >
- {
- template<typename Expr, typename State, typename Data, bool B>
- struct impl2
- : transform_impl<Expr, State, Data>
- {
- typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
- typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;
- typedef typename when<_, A2>::template impl<Expr, State, Data>::result_type a2;
- typedef typename detail::poly_function_traits<Fun, Fun(a0, a1, a2)>::result_type result_type;
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
- ) const
- {
- return typename detail::poly_function_traits<Fun, Fun(a0, a1, a2)>::function_type()(
- detail::as_lvalue(typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d))
- , detail::as_lvalue(typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d))
- , detail::as_lvalue(typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d))
- );
- }
- };
- template<typename Expr, typename State, typename Data>
- struct impl2<Expr, State, Data, true>
- : transform_impl<Expr, State, Data>
- {
- typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;
- typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;
- typedef typename when<_, A2>::template impl<Expr, State, Data>::result_type a2;
- typedef typename Fun::template impl<a0, a1, a2>::result_type result_type;
-
- BOOST_FORCEINLINE
- result_type operator ()(
- typename impl2::expr_param e
- , typename impl2::state_param s
- , typename impl2::data_param d
- ) const
- {
- return typename Fun::template impl<a0, a1, a2>()(
- typename when<_, A0>::template impl<Expr, State, Data>()(e, s, d)
- , typename when<_, A1>::template impl<Expr, State, Data>()(e, s, d)
- , typename when<_, A2>::template impl<Expr, State, Data>()(e, s, d)
- );
- }
- };
-
-
-
-
-
-
-
-
- template<typename Expr, typename State, typename Data>
- struct impl
- : impl2<Expr, State, Data, detail::is_transform_<Fun>::value>
- {};
- };
- #include <boost/proto/transform/detail/call.hpp>
-
-
- template<typename Fun>
- struct is_callable<call<Fun> >
- : mpl::true_
- {};
- }}
- #if defined(_MSC_VER)
- # pragma warning(pop)
- #endif
- #endif
|