
On Sat, Aug 12, 2006 at 07:02:07AM +0800, Joel de Guzman <joel@boost-consulting.com> wrote:
Do we have to write rules for all permutations of A and B and C? What about literals and built-in types? Example:
a_ >> b_ >> "hi" | c_ >> 12345
Of course not. This was just for the example. Usually one would separate the different types into categories or concept, and define rules on top of them. For example in a matrix vector library, one might define the categories matrix, column vector, row vector and scalar. built-in types can be handled by the type adaptation rules: template<typename DomainTag,typename OperatorTag, typename ForeignType, typename EnableIfT = void> struct adapt_type : undefined, mpl::false_ {}; There are also two similar metafunctions called adapt_left and adapt_right specialziable for the user, which call adapt_type in the default implementation. adapt_* just works exactly like rule, the result_type of adapt_* is then used for a rule invokaction. Best Regards Andreas Pokorny