Created by: GBuella
size_t is an unsigned integer, with a conversion rank larger than int, therefore in the following expression the int value was promoted to size_t, making it a subtraction of unsigned values. The result of such a subtraction is also an unsigned value.
size_t space;
int space_required;
abs(space - space_required);
In the realm of integers, it only makes sense to use std::abs with signed values, there is no overloaded version of std::abs in with an unsigned argument (the absolute value of an unsigned integer is itself). The compiler has found the std::abs template in , which resulted in the size_t value being converted to a complex number, on which std::abs<size_t> did operate...
See: https://en.cppreference.com/w/cpp/language/implicit_conversion https://en.cppreference.com/w/cpp/numeric/math/abs https://en.cppreference.com/w/cpp/numeric/complex/abs