[fusion] make_fused arity > 10

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/... 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. Regards, Mario

On Wed, Jul 20, 2011 at 8:22 AM, Mario Mulansky <mario.mulansky@gmx.net>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/... 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

On 07/20/11 10:22, Mario Mulansky 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: [snip] 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.
Christopher Schmidt's conversion of fusion to variadic templates: http://article.gmane.org/gmane.comp.lib.boost.devel/194504 might be some help. I say "might" because it requires using g++ or possibly clang to compile variadic template code and maybe your boss or company won't allow that for some reason. I *think* maybe variadic fusion is here: http://svn.boost.org/svn/boost/sandbox/SOC/2009/fusion/boost/fusion/ but I'd check with Christopher to make sure. -regards, Larry
participants (3)
-
Jeffrey Lee Hellrung, Jr.
-
Larry Evans
-
Mario Mulansky