#ifndef SPROUT_BREED_DETAIL_AS_EXPR_HPP #define SPROUT_BREED_DETAIL_AS_EXPR_HPP #include #include #include #include namespace sprout { namespace breed { namespace detail { template struct base_generator { public: typedef Generator type; }; template struct base_generator > { public: typedef Generator type; }; template struct as_expr; template struct as_expr { public: typedef typename sprout::breed::detail::term_traits::value_type value_type; typedef sprout::breed::expr< sprout::breed::tag::terminal, sprout::breed::term, 0 > expr_type; typedef typename Generator::template result::type result_type; public: SPROUT_CONSTEXPR result_type operator()(T const& t) const { return Generator()(expr_type::make(t)); } }; template struct as_expr { public: typedef typename sprout::breed::detail::term_traits::value_type value_type; typedef sprout::breed::basic_expr< sprout::breed::tag::terminal, sprout::breed::term, 0 > expr_type; typedef typename Generator::template result::type result_type; public: SPROUT_CONSTEXPR result_type operator()(T const& t) const { return Generator()(expr_type::make(t)); } }; template struct as_expr { public: typedef typename sprout::breed::detail::term_traits::value_type value_type; typedef sprout::breed::expr< sprout::breed::tag::terminal, sprout::breed::term, 0 > result_type; public: SPROUT_CONSTEXPR result_type operator()(T const& t) const { return result_type::make(t); } }; template struct as_expr { public: typedef typename sprout::breed::detail::term_traits::value_type value_type; typedef sprout::breed::basic_expr< sprout::breed::tag::terminal, sprout::breed::term, 0 > result_type; public: SPROUT_CONSTEXPR result_type operator()(T const& t) const { return result_type::make(t); } }; template struct as_child; template struct as_child { public: typedef T const& reference; typedef sprout::breed::expr< sprout::breed::tag::terminal, sprout::breed::term, 0 > expr_type; typedef typename Generator::template result::type result_type; public: SPROUT_CONSTEXPR result_type operator()(T const& t) const { return Generator()(expr_type::make(t)); } }; template struct as_child { public: typedef T const& reference; typedef sprout::breed::basic_expr< sprout::breed::tag::terminal, sprout::breed::term, 0 > expr_type; typedef typename Generator::template result::type result_type; public: SPROUT_CONSTEXPR result_type operator()(T const& t) const { return Generator()(expr_type::make(t)); } }; template struct as_child { public: typedef T const& reference; typedef sprout::breed::expr< sprout::breed::tag::terminal, sprout::breed::term, 0 > result_type; public: SPROUT_CONSTEXPR result_type operator()(T const& t) const { return result_type::make(t); } }; template struct as_child { public: typedef T const& reference; typedef sprout::breed::basic_expr< sprout::breed::tag::terminal, sprout::breed::term, 0 > result_type; public: SPROUT_CONSTEXPR result_type operator()(T const& t) const { return result_type::make(t); } }; } // namespace detail } // namespace breed } // namespace sprout #endif // #ifndef SPROUT_BREED_DETAIL_AS_EXPR_HPP