|
Boost : |
From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2004-08-18 10:08:05
I think there's a mismatch in the use of
BOOST_MPL_METAFUNCTION_MAX_ARITY.
mpl::bind<> and aux::template_arity<> both make use of the
BOOST_MPL_METAFUNCTION_MAX_ARITY when generating code. However, bind<>
has an additional leading argument which increases it's arity by one.
This means template_arity<> will return the wrong arity.
This demonstrates the bug:
#include <boost/mpl/bind.hpp>
#include <boost/mpl/lambda.hpp>
using namespace boost::mpl;
template<int N, class T>
void f()
{
T x[-1];
}
int main()
{
f<
aux::template_arity<bind<int> >::value
, bind<int>
>();
}
With gcc3.3 this results in:
arity.cpp: In function `void f() [with int N = 5, T =
boost::mpl::bind<
int
, boost::mpl::void_
, boost::mpl::void_
, boost::mpl::void_
, boost::mpl::void_
, boost::mpl::void_
>
]':
Where N should actually be 6.
-- Daniel Wallin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk