problems with cmath overloaded functions C++
问题 I need to use cmath's abs() function, but Visual Studio says it's overloaded and I can't even use something like this: unsigned a = 5, b = 10, c; c = abs(a-b); I don't know how to use it properly. 回答1: The versions in <cmath> are for floating point types, so there is no unambiguously best match. The overload for integral types are in <cstdlib>, so one of those will yield a good match. If you are using abs on different types, you can use both includes and let overload resolution do its work.