#ifndef SPROUT_BREED_TRANSFORM_CALL_HPP #define SPROUT_BREED_TRANSFORM_CALL_HPP #include #include #include #include #include #include #include #include #include #include namespace sprout { namespace breed { // // call // template struct call : public PrimitiveTransform {}; template struct call : public sprout::breed::transform > { public: template struct impl2 : public sprout::breed::transform_impl { public: typedef typename sprout::breed::detail::std_result_of::type result_type; public: SPROUT_CONSTEXPR result_type operator()( typename impl2::expr_param, typename impl2::state_param, typename impl2::data_param ) const { return Fun()(); } }; template struct impl2 : public Fun::template impl {}; template struct impl : public impl2::value> {}; }; template struct call : public sprout::breed::transform > { public: template struct impl2 : public sprout::breed::transform_impl { private: template struct a_ { public: typedef typename sprout::breed::when::template impl< Expr, State, Data > type; }; template struct fun_ { public: typedef Fun type(typename a_::type::result_type...); }; template struct function_ : public sprout::breed::detail::poly_function_traits< Fun, typename fun_::type > {}; public: template struct a { public: typedef typename a_::type>::type::result_type type; }; typedef function_ function_traits; typedef typename function_traits::result_type result_type; SPROUT_CONSTEXPR result_type operator ()( typename impl2::expr_param e, typename impl2::state_param s, typename impl2::data_param d ) const { return typename function_traits::function_type()( sprout::breed::detail::as_lvalue(a_()(e, s, d)) ); } }; template struct impl2 : public sprout::breed::transform_impl { private: template struct a_ { public: typedef typename sprout::breed::when::template impl< Expr, State, Data > type; }; typedef Fun::template impl::type, State, Data> function_; public: template struct a { public: typedef typename a_::type>::type::result_type type; }; typedef template function_::result_type result_type; SPROUT_CONSTEXPR result_type operator ()( typename impl2::expr_param e, typename impl2::state_param s, typename impl2::data_param d ) const { return function_()( typename a_::type()(e, s, d), s, d ); } }; template struct impl : public impl2::value> {}; }; template struct call : public sprout::breed::transform > { public: template struct impl2 : public sprout::breed::transform_impl { private: template struct a_ { public: typedef typename sprout::breed::when::template impl< Expr, State, Data > type; }; template struct fun_ { public: typedef Fun type(typename a_::type::result_type...); }; template struct function_ : public sprout::breed::detail::poly_function_traits< Fun, typename fun_::type > {}; public: template struct a { public: typedef typename a_::type>::type::result_type type; }; typedef function_ function_traits; typedef typename function_traits::result_type result_type; SPROUT_CONSTEXPR result_type operator ()( typename impl2::expr_param e, typename impl2::state_param s, typename impl2::data_param d ) const { return typename function_traits::function_type()( sprout::breed::detail::as_lvalue(a_()(e, s, d)), sprout::breed::detail::as_lvalue(a_()(e, s, d)) ); } }; template struct impl2 : public sprout::breed::transform_impl { private: template struct a_ { public: typedef typename sprout::breed::when::template impl< Expr, State, Data > type; }; typedef Fun::template impl::type, typename a_::type, Data> function_; public: template struct a { public: typedef typename a_::type>::type::result_type type; }; typedef template function_::result_type result_type; SPROUT_CONSTEXPR result_type operator ()( typename impl2::expr_param e, typename impl2::state_param s, typename impl2::data_param d ) const { return function_()( typename a_::type()(e, s, d), typename a_::type()(e, s, d), d ); } }; template struct impl : public impl2::value> {}; }; template struct call : public sprout::breed::transform > { public: template struct impl2 : public sprout::breed::transform_impl { private: template struct a_ { public: typedef typename sprout::breed::when::template impl< Expr, State, Data > type; }; template struct fun_ { public: typedef Fun type(typename a_::type::result_type...); }; template struct function_ : public sprout::breed::detail::poly_function_traits< Fun, typename fun_::type > {}; public: template struct a { public: typedef typename a_::type>::type::result_type type; }; typedef function_ function_traits; typedef typename function_traits::result_type result_type; SPROUT_CONSTEXPR result_type operator ()( typename impl2::expr_param e, typename impl2::state_param s, typename impl2::data_param d ) const { return typename function_traits::function_type()( sprout::breed::detail::as_lvalue(a_()(e, s, d)), sprout::breed::detail::as_lvalue(a_()(e, s, d)), sprout::breed::detail::as_lvalue(a_()(e, s, d)) ); } }; template struct impl2 : public sprout::breed::transform_impl { private: template struct a_ { public: typedef typename sprout::breed::when::template impl< Expr, State, Data > type; }; typedef Fun::template impl::type, typename a_::type, typename a_::type> function_; public: template struct a { public: typedef typename a_::type>::type::result_type type; }; typedef template function_::result_type result_type; SPROUT_CONSTEXPR result_type operator ()( typename impl2::expr_param e, typename impl2::state_param s, typename impl2::data_param d ) const { return function_()( typename a_::type()(e, s, d), typename a_::type()(e, s, d), typename a_::type()(e, s, d) ); } }; template struct impl : public impl2::value> {}; }; template struct call : public sprout::breed::transform > { public: template struct impl : public sprout::breed::transform_impl { private: template struct a_ { public: typedef typename sprout::breed::when::template impl< Expr, State, Data > type; }; template struct fun_ { public: typedef Fun type(typename a_::type::result_type...); }; template struct function_ : public sprout::breed::detail::poly_function_traits< Fun, typename fun_::type > {}; public: template struct a { public: typedef typename a_::type>::type type; }; template struct b { public: typedef typename a_::type>::type::result_type type; }; typedef function_ function_traits; typedef typename function_traits::result_type result_type; SPROUT_CONSTEXPR result_type operator ()( typename impl2::expr_param e, typename impl2::state_param s, typename impl2::data_param d ) const { return typename function_traits::function_type()( sprout::breed::detail::as_lvalue(typename a_::type()(e, s, d))... ); } }; }; // // is_callable // template struct is_callable > : public std::true_type {}; } // namespace breed } // namespace sprout #endif // #ifndef SPROUT_BREED_TRANSFORM_CALL_HPP