Boost logo

Boost :

From: Maurizio Vitale (mav_at_[hidden])
Date: 2007-04-26 05:39:12


I don't know if something can be done, but it would have saved me quite some time.

Here what happened:
   - I was moving my small example to a more realistic case. As ususal, example
     works and reality doesn't care.

   - In the example I had terminal<number<_,_> > and all was kosher. I tried to add
     a template parameter with a default value, just to make sure I could still have
     patterns with all arguments and everything was fine.

   - now in reality my number has 6 template arguments. 6 is larger than 5, and
     with this I've given out what happened, at least to Eric. For others, 5 is the
     default maximum number of arguments in proto expressions.

So far, so good. The problem is that my grammar had a pattern
terminal<number<_,_,_,_,_,_> >. I don't know if it is possible to
make proto complain hard and loud about building a pattern (or other expressions)
with more arguments than the maximum allowed by configuration, but in my case
the pattern was not matching causing my expressions to be invalid.

And the error from GCC was nothing hinting at grammars, matches or anything.
It was just saying that overloads for operators where ambiguous (because
of my operator int and unsigned int, I don't know what it would have
happened without).

And I think that 6 is a better default value for the number of allowed arguments.
Just kidding, as long as defining it before including proto headers is officially
blessed and documented, I'm ok.

Another nice thing to have, although I would only put it in if very easy to code:
especially in presence of default parameters it might be nice to have a pattern matching
"the rest of the argument list". Something like a proto::___.

Cheers,

        Maurizio


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