Boost logo

Boost Users :

Subject: [Boost-users] find the largest/most precise of two types
From: Alex Flint (alex.flint_at_[hidden])
Date: 2009-05-20 10:43:57


Hi there,
I have a bunch of functions that accept two numeric arguments. In the
case that the types of these arguments are different I want to figure
out what the return type should be. The rule I would like to use is
that the largest of the two types should be used for internal
computations and the return type.

f(someFloat, someDouble) -> double
f(someFloat, someFloat) -> float
f(someInt, someFloat) -> float

Is there a way I can do this, perhaps with boost's type_traits?

Cheers,
Alex


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