|
Boost : |
From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-03-29 13:27:22
Jeremy Siek wrote:
> I agree, we certainly do need result type traits, however
> I think the requirements on the result type produced should
> remain what I've stated, convertible to X and models ...
>
> To allow for expression templates, the result type will not
> only depend on the operands but also on the operator.
> Therefore we need a tag for each operator.
>
> struct add_tag { };
> struct multiply_tag { };
> ...
>
> and then make the operator tag a parameter to the traits class
>
> result_traits<OpTag,A,B>::type
>
> For builtin types, the result_traits can dispatch to the simpler
> promotion traits class that does not care about the operator.
..for example to the 'boost::arithmetic_conversions_traits<>' class template
(see http://groups.yahoo.com/group/boost/message/7182 thread and
http://groups.yahoo.com/group/boost/files/types_promotion_traits/types_promo
tion_traits.hpp)
Aleksey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk