Boost logo

Boost Users :

From: Andy Little (andy_at_[hidden])
Date: 2005-09-30 10:45:36


"Howard Hinnant" <hinnant_at_[hidden]> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net