
30 Sep
2005
30 Sep
'05
3:45 p.m.
"Howard Hinnant" <hinnant@twcny.rr.com> wrote
If the intent is to implement 8.16.4 (from N1836), I don't think this does it. Consider this test for example:
double x = hypot(99., 20); assert(x == 101.);
This is the same issue with std::complex isnt it? : complex<double> x; 2 * x; // cant deduce function It would be easily fixable with typeof: template<typename X, typename Y> typeof( sqrt( X() * X() + Y() * Y())) hypot( X ,Y); a promoted<X,Y>::type would work for inbuilt types, but it wouldnt always work for more complicated cases http://www.servocomm.freeserve.co.uk/Cpp/physical_quantity/index.html ;-) nevertheless maybe a promoted<X,Y>::type is a suitable candidate for type_traits ? regards Andy Little