Boost logo

Boost :

Subject: Re: [boost] Mixing protocol
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-01-15 14:35:04


AMDG

Joel Falcou wrote:
> So far BOOST proposes various prtocols for meta-function :
>
> - the result_of protocol
> - the apply<> protocol of MPL
> - the ::type protocol of traits
>
> Can those protocols be mixed somehow without any side-effects when used
> with the various aforementionned protocol ?

What do you mean by mixed?

result_of looks for a nested result or result_type only. It is
unaffected by apply/type.

MPL uses both apply and type and also has a metafunction called apply:

struct identity {
    template<class T>
    struct apply {
        typedef T type;
    };
};

typedef mpl::apply<identity, int>::type int_;

boost::mpl::apply is generally preferable, because it works
with MPL Lambda expressions as well as metafunction classes.

In Christ,
Steven Watanabe


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