Boost logo

Boost :

From: Brian Braatz (brianb_at_[hidden])
Date: 2005-11-01 16:16:35


Your email inspired me to go look through code as I was certain I had run
into this too. Turns out I have similar code to below with a comment that
says" todo figure out why this needs to be indirected".

If it is any help, I had this problem on BOTH GCC4 and VC71, so it doesn't
seem to be a compiler specific issue.

On 11/1/05 11:21 AM, "Eric Niebler" <eric_at_[hidden]> wrote:

> I have an MPL sequence of metafunction classes. I want to apply<> each
> with mpl::transform. So I did this:
>
> struct metafnclass
> {
> template<typename T> struct apply
> { typedef T type; };
> };
>
> typedef mpl::vector<metafnclass, metafnclass> metafnclasses;
>
> typedef mpl::transform<
> metafnclasses
> , mpl::apply<mpl::_1, int>
>> ::type transmetafnclasses;
>
> This fails horribly, and I don't know why. If I add an indirection like
> this:
>
> template<typename T,typename U> struct indirect_apply
> : mpl::apply<T, U> {};
>
> typedef mpl::transform<
> metafnclasses
> , indirect_apply<mpl::_1, int>
>> ::type transmetafnclasses;
>
> then it works fine. Why should that be? Is something getting evaluated
> too eagerly?


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