Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2003-02-07 08:56:26

Andreas Huber wrote:
> The attached code works like a dream on MSVC 7.1, but MSVC 7.0 again
> has its problems:
> Problem No. 1: Expression 1 does not seem to work, because
> Derived is an incomplete type:
> To reproduce, you might want to comment-out expression 3 and
> uncomment expression 4.

OK, I see the problem; fixed now in the CVS.

But what I was horrified by is the way VC 7.0 masks the errors here.
It's the first time I saw something like this (I don't use 7.0 in
day-to-day work), and I just hope you didn't spent too much time
figuring out what was happenning there. FYI, MSVC 6.5 is much more
predictable and easy to work with in this regard, and since, from
MPL-centric point of view, the compilers are pretty much at the
the same level of standard conformance, for debugging purposes
you might consider using 6.5 (if you have one, of course).

> Problem No. 2: mpl::fold produces errors similar to the ones
> I had with transform yesterday
> In the original file, please comment out expression 1 and uncomment
> expression 2 to reproduce.

Oh, this one is known - please see

Item 5.7

But actually you don't need to implement your own 'derive'
metafunction, MPL already does it for you:

#include "boost/mpl/inherit.hpp"
#include "boost/mpl/empty_base.hpp"

// ...

// was:
// typedef typename mpl::fold< /* 3 */
// handler_list, empty_type, derive< _1, _2 > >::type type;

        typedef typename mpl::fold<
              handler_list, mpl::empty_base, mpl::inherit< _1, _2 >
>::type type;

or, shorter yet,

#include "boost/mpl/inherit_linearly.hpp"

// ...
        typedef typename mpl::inherit_linearly<
            , mpl::inherit<_1,_2>
>::type type;

The same for 'make_list' - the MPL version is called 'as_sequence',
please see "boost/mpl/as_sequence.hpp".

> Luckily, I can continue with MSVC7.1 now, so these bugs have
> low priority.

Nonetheless, they are fixed in the CVS now :).

Thanks for the reports,

Boost list run by bdawes at, gregod at, cpdaniel at, john at