Boost logo

Boost :

From: joel de guzman (djowel_at_[hidden])
Date: 2002-03-27 09:28:57

----- Original Message -----
From: "Peter Dimov" :

> From: "Jaakko Jarvi" <jajarvi_at_[hidden]>
> > 2) The outermost return type deduction layer in LL works as
> >
> > return_type<Functor, argument_types>::type
> >
> > whereas in Phoenix the scheme introduced in FC++ is used:
> >
> > Functor::return_type<argument_types>::type
> >
> > Both are equally powerful,
> No, they are not. You can't add a return_type nested template to a
> third-party (or stdlib) function object. LL's approach is better.

1) With LL's traits approach, you have to make the namespace LL
open to *ALL* return_type traits specializations.

2) There's a non-nested class called actor_result that can be specialized.
Here it is:

template <typename ActorT, typename TupleT>
struct actor_result {

    typedef typename ActorT::template result<TupleT>::type type;
    typedef typename remove_reference<type>::type plain_type;

All return type deduction pass through this and **not** directly to
the actor's nested template.

3) There's a composite_result template for each composite
from 0 arg to N args that can also be specialized. Here's
the composite1_result, for example:

template <typename OperationT, typename TupleT,
    typename A>
struct composite1_result {

    typedef typename OperationT::template result<
        typename actor_result<A, TupleT>::plain_type
>::type type;

All return type deduction for composites pass through this and
**not** directly to the functor's nested template.

Conclusion: Phoenix allows you to do both.


Boost list run by bdawes at, gregod at, cpdaniel at, john at