
I thought that was only for checking range. Or do you mean round(), and then numeric_cast<>() instead of checking range manually in round_cast<>()?
Ah, that can be customized with a policy, but the only rounding (not Floor/Ceil/Trunc) policy provided is RoundEven which doesn't do exactly what I want, while math::round does ;)
Besides, with math::round() I can use the same policy I use for other math functions.
Nod. I guess the functions could something like: template <class R, class T> R round_to(const T&); template <class R, class T> R trunc_to(const T&); which would provide generic versions of iround/itrunc (although R need not be an integer type, as long as there's a static_cast from T to R). I'm not particularly sold on those names though, I guess "round_cast/trunc_cast" would be an alternative. John.