Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2007-10-23 09:46:05


Douglas Gregor wrote:
> Stjepan Rajko wrote:
>> For my specializable functions, I adapted what is used in fusion, e.g.:
>>
>> template<typename ProducerTag, ConsumerTag>
>> struct operation_impl;
>>
>> template<>
>> struct operation_impl<some_producer_tag, some_consumer_tag>
>> {
>> template<typename P, typename C>
>> struct apply
>> {
>> typedef some_result_type type;
>>
>> static type call(P &p, C &c)
>> {
>> ...
>> }
>> };
>> };
>>
> IIRC, using this form makes operation_impl<some_producer_tag,
> some_consumer_tag> into an MPL metafunction class, which makes it usable
> with all of the various metafunction algorithms. That's important if you
> need to use MPL algorithms across sequences of producer/consumer types.

Yes, that way, fusion can take advantage of MPL facilities like
mpl lambda: very useful, IMO.

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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