Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2000-12-04 22:45:53


Oh, and another issue. When writing expression template codes, you also
need to get return types of unary expressions, and those return types may
depend on the argument type and the operation. So we should consider
having both binary and unary operator promotion traits.

On Mon, 4 Dec 2000, Aleksey Gurtovoy wrote:
>
> Jeremy Siek wrote:
> > Does what operator is being applied ever make a difference in the type
> > promotion? If this is the case then the traits would need a third
> > parameter, perhaps a tag for the operator. In the following example it
> > would be something like "add_tag".
> >
> > types_promotion_traits<add_tag, T1, T2>::type
>
> It doesn't make difference for built-in types (and operations like +,-,*,/
> etc.), but it could for user-defined types. So you think you are right and we
> need some way of specifying a kind of operation; that's actually the Lambda
> library does that too, but not in so simple way :). Actually, the
> 'types_promotion_traits' template is implemented on top of the
> 'arithmetic_conversions_traits' class template:
>
> // to be specialized for user-defined types
> template<typename T1, typename T2>
> struct types_promotion_traits {
> typedef arithmetic_conversions_traits<T1, T2>::type type;
> };
>
> so adding an operation tag here is a matter of minutes :) (it doesn't affect
> built-in types semantics, so IMO it shouldn't be propagated any futher than
> this template)
>
> --Aleksey
>
>
>
>
>

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------


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