|
Boost : |
From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2000-12-04 12:40:00
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk