|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-01-12 08:51:13
"Jaap Suter" <J.Suter_at_[hidden]> writes:
>> > Hi,
>>
>> Hi Jaap,
>
> Wow, fast reply. Thanks!
>
>> including MSVC 6.5/7.0 (assuming the latest CVS sources). Or are you using
>> the 1.29.0 archive?
>
> I have the latest CVS sources (I did a full 'get' over the 1_29_0 release in
> case you wonder where the boost_1_29_0 directory comes from in the path
> below).
>
>> > but that didn't fix it.
>>
>> Hmm, works for me, even if I remove the 'plus' inheritance:
>
> You are right, I apologize. I never actually tried the example in the
> original post, I just assumed that it was the same as the actual code.
> However, after your reply I tried it, and it does in fact compile. So I
> tried to come up with the actual smallest example that doesn't compile, even
> with the LAMBDA_SUPPORT macro. It looks as follows:
>
> template< class T >
> struct meta_fun_1
> {
> typedef mpl::integral_c< typename T::value_type, 0 > type;
> BOOST_MPL_AUX_LAMBDA_SUPPORT( 1, meta_fun_1, (T) )
> };
>
> template< class List, class T >
> struct meta_fun_2
> {
> typedef typename mpl::fold< List,
> mpl::integral_c< size_t, 0 >,
> meta_fun_1< mpl::_1 >
> >::type type;
> };
Provided I add the neccessary prelude (below), that compiles fine for
me on vc7. Don't you need to instantiate these to see the error?
# include <boost/mpl/integral_c.hpp>
# include <boost/mpl/aux_/lambda_support.hpp>
# include <boost/mpl/fold.hpp>
# include <cstddef>
namespace mpl = boost::mpl;
using std::size_t;
------
Hmm, OK, here's a minimal case:
# include <boost/mpl/integral_c.hpp>
# include <boost/mpl/aux_/lambda_support.hpp>
# include <boost/mpl/fold.hpp>
# include <boost/mpl/list_c.hpp>
# include <boost/mpl/int_c.hpp>
# include <cstddef>
namespace mpl = boost::mpl;
using std::size_t;
template< class T, class U >
struct meta_fun_1
: mpl::integral_c< typename T::value_type, 0 >
{
BOOST_MPL_AUX_LAMBDA_SUPPORT( 2, meta_fun_1, (T,U) )
};
typedef mpl::fold< mpl::list_c<int, 1, 3, 5>,
mpl::integral_c< size_t, 0 >,
meta_fun_1< mpl::_1, mpl::_2 >
>::type too;
I see the problem :(
Incidentally, your example is trying to pass a unary metafunction to
fold; it should be binary. But that has nothing to do with it :(
-- David Abrahams dave_at_[hidden] * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk