Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2005-11-01 14:21:43


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?

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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