Boost logo

Boost :

From: J.F.K. (beholder_at_[hidden])
Date: 2003-10-10 00:16:01


hello, Neal
I've used this promote_traits<> class in my project
try it if you wish
and I'll be very interested in any ideas to make it more
general, but not as general as Joel solution :)

regards, Oleg

----- Original Message -----
From: "Neal D. Becker" <nbecker_at_[hidden]>
Newsgroups: gmane.comp.lib.boost.devel
Sent: Tuesday, 07 October, 2003 18:55
Subject: Simplifying promote_traits

> I frequently need to write arithmetic algorithms which may need to infer the
> type of intermediate variables. These algorithms will be used with mixed
> types, such as:
>
> double, std::complex<double>
> int, std::complex<int>
>
> I have looked at boost/numeric/ublas/traits.hpp, at promote_traits class. It
> seems that this suffers from a quadratic explosion, needing to define a
> specialization for every combination of <T1, T2>.
>
> I think it would be simpler to use boost::is_convertible. The type of the
> product of two types T1, T2 is T1 if T2 is convertible to T1, T2 if T1 is
> convertible to T2, and undefined otherwise.
>
> This might be overly general, but I think the simplicity of the design is more
> significant.
>
> Any thoughts?
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>





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