Boost logo

Boost :

From: Andreas Pokorny (andreas.pokorny_at_[hidden])
Date: 2006-08-12 04:01:09

On Sat, Aug 12, 2006 at 07:02:07AM +0800, Joel de Guzman <joel_at_[hidden]> 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

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

Boost list run by bdawes at, gregod at, cpdaniel at, john at