Boost logo

Boost :

Subject: Re: [boost] Trouble caused by MPL's metafunction arity limit
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-07-20 02:55:08


----- Original Message -----
From: "Stefan" <mstefanro_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, July 20, 2010 3:09 AM
Subject: [boost] Trouble caused by MPL's metafunction arity limit

>
> Hello everyone. I'm working as a student on this year's GSoC and I have
> ran into a small problem while using MPL in my code.
> In a nutshell, I have a class template which takes 6 template
> parameters, and I would like to use it with some MPL algorithms.
> The problem is, MPL is configured by default to be capable of working
> with 5 template params only, so lambda expressions of my class won't
> work with MPL metafunctions.
> My code is header-only, meaning I cannot (re)define
> BOOST_MPL_LIMIT_METAFUNCTION_ARITY appropriately, as the MPL headers
> might have been included before my headers.
> Out of my 6 template params, 3 are optional, in case this is relevant or
> can be exploited in any way.
> Is there any workaround to my problem?

Hi,

Either you rely on the user defining it to at least 6 or you ensure it yourself. I think that the macros is not used until you instantiate a class. So, have you tried to redifine it to ensure that it is GE 6

#if defined BOOST_MPL_LIMIT_METAFUNCTION_ARITY
#if BOOST_MPL_LIMIT_METAFUNCTION_ARITY <6
#undef BOOST_MPL_LIMIT_METAFUNCTION_ARITY
#define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 6
#endif
#else
#define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 6
#endif
#include <boost/mpl/.....hpp>

HTH,
Vicente


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