Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-04-14 22:00:04


Joel de Guzman wrote:

> ----- Original Message -----
> From: "David Abrahams" :
>
> > > 2) the porting of fold and map (is there a map?) to less conformant
> > > compilers.
> >
> > They already work on MSVC6. I don't think we're targeting anything
> > less-conformant.
> > (map is called transform, last I looked).
>
> ----- Original Message -----
> From: "Aleksey Gurtovoy"
> >
> > "The long" version is more portable (lambda facility requires partial
> > specialization and template template parameters), and it taxes the
compiler
> > a little bit more.
>
> I see a contradiction here. I'm confused.

There is no contradiction. Both version use the same 'fold' algorithm. It's
the lambda facility that doesn't work on MSVC6, so the library have to
define the auxiliary "next_if" metafunction class

template< typename Predicate >
struct next_if
{
    template< typename N, typename T > struct apply
    {
        typedef typename select_if<
              apply<Predicate,T>::value
            , typename next<N>::type
            , N
>::type type;
    };
};

instead of implementing the same thing through inline metafunction
composition (select_if< apply<Predicate,_2>, next<_1>, _1 >). That's the
only difference between "the long" and the lambda-based versions.

Aleksey


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