Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-05-03 19:50:57

Maurizio Vitale wrote:
> Another data point: even though the above code compile with 8 and 7, in
> my real code I get a match failure on number<_,_,_,_,_,_,_,_> [8] or
> number<_,_,_,_,_,_,_> [7]. As far as I can tell, the only difference
> between the working code and the non-working code is the additional
> template arguments to number<>, which are not used.

This is only a problem on GCC because of a compiler bug wrt template
template parameters. Proto reuses a work-around from the MPL, which is
conditioned on an MPL macro called BOOST_MPL_LIMIT_METAFUNCTION_ARITY.
If you define this to be at least as large as BOOST_PROTO_MAX_ARITY, the
problem goes away.

I've added some code to check for this condition and fail loudly at
compile time.

Also, in another mail, you say:

> I'm really interested in having patterns with those many arguments, so once
> the variable controlling the maximum arity and the one controlling the maximum
> number of subpatterns in a pattern get decoupled I may be fine, but still
> giving a clear error message would be helpful.

Depending on what "number of subpatterns in a pattern" means, you may
already have what you want. There is a separate macro called
BOOST_PROTO_MAX_LOGICAL_ARITY which controls how many parameters
proto::or_ and proto::and_ accept. It is independent of
BOOST_PROTO_MAX_ARITY. For the time being, whether a pattern such as
number<_,_,_,_,_,_,_,_> is accepted is controlled by BOOST_PROTO_MAX_ARITY.

Eric Niebler
Boost Consulting

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