Boost logo

Boost :

Subject: Re: [boost] [fusion] make_fused arity > 10
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-07-20 12:17:33


On Wed, Jul 20, 2011 at 8:22 AM, Mario Mulansky <mario.mulansky_at_[hidden]>wrote:

> Hi
>
> We are using Boost.Fusion quite heavily in our library [odeint] and I just
> came across some problem that took me several hours to solve so I decided to
> let you know about the issue.
> We use boost::fusion::make_fused to make functor applicable to fusion
> sequences and as we occasionally deal with long vectors we increased the
> limits as described here:
>
> http://www.boost.org/doc/libs/1_47_0/libs/fusion/doc/html/fusion/functional/adapters/limits.html
> At first we used 10 as maximum (also changing FUSION_MAX_VECTOR_SIZE and
> the ..INVOKE.. constants, of course). However, today I extended the library
> and had to increase these values to 16. Unfortunately, that did not work -
> compiling still failed at functors with arity 11. So I digged into
> Boost.Fusion and after quite some time I realized that it relies on
> boost::result_of which has an upper limit of 10. So additionally changing
> BOOST_RESULT_OF_NUM_ARGS to 16 made everything work, eventually.
>
> I think the point here is that defining BOOST_FUSION_UNFUSED_MAX_ARITY > 10
> without also defining BOOST_RESULT_OF_NUM_ARGS accordingly will break the
> code in a rather confusing way - I think at least adding a note in the docs
> could be very helpful here.
>

Even better would be a preprocessor assertion...?

#if BOOST_RESULT_OF_NUM_ARGS < BOOST_FUSION_UNFUSED_MAX_ARITY
#error ...
#endif // #if BOOST_RESULT_OF_NUM_ARGS < BOOST_FUSION_UNFUSED_MAX_ARITY

- Jeff


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