Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2006-08-14 22:26:51


"Andreas Pokorny" wrote
> Hi,
>
> "Andy Little" wrote
>> "Joel de Guzman" wrote
>> > IIUC, the "rule" specifies the result type (not deduces the
>> > result type). I think it's not a macro at all; it would rather
>> > be something like: "unspecified_type", or
>> > "you-define-your-type-here-and-ill-do-the-rest"
>>
>> Well again I am probably not understanding it fully, but from one of
>> Andreas
>> posts higher in the thread:
>>
>> get_result_type<add_tag,LeftT,RightT>
>>
>> presumably could be implemented as:
>>
>> template <typename LeftT, typename RightT>
>> struct get_result_type<add_tag,LeftT,RightT>
>> {
>> typedef BOOST_TYPEOF_TPL(LeftT() + RightT()) type;
>> };
>
> That would be a hen-egg situation. The result_type of the
> operator is defined by the rules, not the other way around.
> Like the Joel said, the encoding of the expression tree into
> operator and function return types is up to the user.

So the user must create special types solely for the purposes of the framework?

cant I use the E.T engine on (say) 2 int's:

int a,b;
ETexpression_<
    ETexpression_<int>,
    plus_tag,
    ETexpression_<int>
>::result_type result = ETexpression(a) + ETexpression(b);

regards
Andy Little


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