Possible Duplicate:
Best way to detect integer overflow in C/C++
Currently I use the following function:
template<typename T, typename U>
bool is_mul_safe(T x, U y) {
return (ld(x * 1.) + ld(y * 1.)) - (sizeof(decltype(x * y)) << 3) <= 0;
}
Is there a standard library function which provides the same functionality?