#ifndef SPROUT_BREED_DOMAIN_HPP #define SPROUT_BREED_DOMAIN_HPP #include #include #include #include #include #include #include namespace sprout { namespace breed { namespace detail { struct not_a_generator {}; struct not_a_grammar {}; struct not_a_domain {}; } // namespace detail namespace domainns_ { // // domain // template< typename Generator, typename Grammar, typename Super > struct domain : public Generator { public: typedef Generator breed_generator; typedef Grammar breed_grammar; typedef Super breed_super_domain; typedef domain breed_base_domain; typedef void breed_is_domain_; public: template struct as_expr : public detail::as_expr< T, typename sprout::breed::detail::base_generator::type, sprout::breed::wants_basic_expr::value > { public: SPROUT_BREED_CALLABLE() }; template struct as_expr { public: SPROUT_BREED_CALLABLE() public: typedef typename std::remove_const::type result_type; public: SPROUT_CONSTEXPR result_type operator()(T const& e) const { return e; } }; template struct as_child : public detail::as_child< T, typename sprout::breed::detail::base_generator::type, sprout::breed::wants_basic_expr::value > { public: SPROUT_BREED_CALLABLE() }; template struct as_child { public: SPROUT_BREED_CALLABLE() public: typedef T &result_type; public: SPROUT_CONSTEXPR result_type operator()(T const& e) const { return e; } }; }; // // default_domain // struct default_domain : public sprout::breed::domain<> {}; // // basic_default_domain // struct basic_default_domain : public sprout::breed::domain {}; // // deduce_domain // struct deduce_domain : public sprout::breed::domain< sprout::breed::detail::not_a_generator, sprout::breed::detail::not_a_grammar, sprout::breed::detail::not_a_domain > {}; // // base_expr // template struct base_expr { public: typedef sprout::breed::expr type; }; template struct base_expr { public: typedef sprout::breed::basic_expr type; }; } // namespace domainns_ // // is_domain // template struct is_domain : public std::false_type {}; template struct is_domain : public std::true_type {}; // // domain_of // template struct domain_of { public: typedef sprout::breed::default_domain type; }; template struct domain_of { public: typedef typename T::breed_domain type; }; template struct domain_of { public: typedef typename sprout::breed::domain_of::type type; }; template struct domain_of, void> { public: typedef typename sprout::breed::domain_of::type type; }; template struct domain_of const, void> { typedef typename sprout::breed::domain_of::type type; }; // // is_sub_domain_of // template struct is_sub_domain_of : public is_sub_domain_of {}; template struct is_sub_domain_of : public std::false_type {}; template struct is_sub_domain_of : public std::true_type {}; } // namespace breed } // namespace sprout #endif // #ifndef SPROUT_BREED_DOMAIN_HPP