Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-08-08 07:56:26


"David B. Held" <dheld_at_[hidden]> writes:

> It seems to me that in a policy-based design, the main class needs
> to know if the policies are metafunctions or metafunction classes.
> Now, I was under the impression, based on what Aleksey said a long
> time ago, that these are basically interchangeable through a lambda-
> based policy adaptor.

No, metafunction classes and *lambda expressions* are interchangeable
through lambda.

        lambda<my<lambda_expr, _1, ession<_2> > >::type

is a metafunction class qeuivalent to:

    struct
    {
        template <class A1, class A2>
        struct apply
        {
            typedef typename my<
                lambda_expr
              , A1
              , typename ession<A2>::type
>::type type;
        };
    };

and

    lambda<some_metafunction_class>::type

is a metafunction class equivalent to

     some_metafunction_class.

Don't pass metafunctions directly; it's bad for interoperability.
Then you get a metafunction taking a template template parameter, and
you can't use it in lambda expressions.

HTH,

-- 
Dave Abrahams
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