Boost logo

Boost :

From: Neal D. Becker (nbecker_at_[hidden])
Date: 2003-10-07 06:55:59

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

Any thoughts?

Boost list run by bdawes at, gregod at, cpdaniel at, john at