Boost logo

Boost :

From: Maurizio Vitale (mav_at_[hidden])
Date: 2007-05-10 13:46:19


I've hit something that I find weird in the behaviour of transforms. I don't know what is the intention.

Basically, what seem to be happening is that if a transform doesn't cover all the cases but a pattern
matches at some external level, then that is taken as a match.
For instance, given the following transform:

    struct width_transform : proto::or_ <
      terminal_width<proto::terminal< number<_> > >,
      binary_width<proto::binary_expr<proto::tag::plus, width_transform, width_transform> >
> {};

and evaluating the transform for proto::binary_expr<proto::tag::minus, something, something>, I get binary_width "called".
If I add a pattern for proto::binary_expr<_, width_transform, width_transform> then that pattern is used.

I would expect a failure at compile time, but in any case adding a wider pattern after a narrower pattern should never change
whether the former matches or not.

Unless I'm making something stupid, in which case just let me know, I'm used to it.

Best regards,

     Maurizio


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk