Boost logo

Boost :

Subject: Re: [boost] [phoenix] not playing nice with other libs
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2011-05-02 07:18:15


On Mon, May 2, 2011 at 12:54 PM, Eric Niebler <eric.niebler_at_[hidden]> wrote:
> The following trivial program fails to compile:
>
>  #include <boost/phoenix/core/limits.hpp>
>  #include <boost/numeric/conversion/converter.hpp>
>
> It generates the following:
>
> In file included from
> ../../../../branches/release/boost/numeric/conversion/detail/is_subranged.hpp:17,
>                 from
> ../../../../branches/release/boost/numeric/conversion/detail/conversion_traits.hpp:21,
>                 from
> ../../../../branches/release/boost/numeric/conversion/conversion_traits.hpp:13,
>                 from
> ../../../../branches/release/boost/numeric/conversion/converter.hpp:13,
>                 from main.cpp:2:
> ../../../../branches/release/boost/mpl/multiplies.hpp:38: error: wrong
> number of template arguments (12, should be 5)
> ../../../../branches/release/boost/mpl/aux_/preprocessed/gcc/times.hpp:68:
> error: provided for ‘temp
> late<class N1, class N2, class N3, class N4, class N5> struct
> boost::mpl::times’
>
> Phoenix is changing the following fundamental constants:
>
>  BOOST_PROTO_MAX_ARITY
>  BOOST_MPL_LIMIT_METAFUNCTION_ARITY
>  BOOST_PROTO_MAX_LOGICAL_ARITY
>  BOOST_RESULT_OF_NUM_ARGS
>
> IMO, Phoenix shouldn't be touching these. It should work as best it can
> with the default values. Users who are so inclined can change them.

Eric,
This problem is well known. As of now I have no clue how to fix it properly.

Let me sketch why i changed these constants:
1) Phoenix V2 has a composite limit of 10:
   This is equivalent to the number of child expressions a expression can hold.
   This is controlled by BOOST_PROTO_MAX_ARITY for the number of
   template arguments for proto::expr and proto::basic_expr
2) Boost.Bind can take up to 10 parameters in the call to boost::bind

The default BOOST_PROTO_MAX_ARITY is 5.

The BOOST_RESULT_OF_NUM_ARGS constant needed to be changed because i
needed to provide 11 arguments in a "call" to boost::result_of. But i
guess a workaround
can be found in this specific case.

I wonder what qualifies as "User". Phoenix is certainly a user of mpl,
result_of and proto.
Spirit is a user of proto and phoenix. Spirit needs an arity of 7 (IIRC).

Anybody got any ideas?

One idea that comes to my mind is having a phoenix::proto_expr,
which is a proto::basic_expr, basically.
Not sure if that would work though


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