First, do read the notes on the cppreference page for isspace:
https://en.cppreference.com/w/cpp/string/byte/isspace
Like all other functions from <cctype>, the behavior of std::isspace is undefined if the argument's value is neither representable as unsigned char nor equal to EOF. To use these functions safely with plain chars (or signed chars), the argument should first be converted to unsigned char
Similarly, they should not be directly used with standard algorithms when the iterator's value type is char or signed char. Instead, convert the value to unsigned char first
As to why it doesn't work, consider this:
int foospace(int c)
{
return c == ' ';
}
int foospace(char c)
{
return c == ' ';
}
void foo()
{
const std::string text = "Hello Cruel World!";
auto is_empty = std::all_of(text.begin(), text.end(), foospace);
}
That fails, but remove either one of the overloads and it works.
std::isspace in <cctype> is supposed to take an int. I don't know where the other overload is coming from, nor what its argument type is. It's unfortunate that the compiler doesn't point out the overloads that it has considered. You might like to grep the headers!
So std::isspace is now the name of an overload-set, not a function. Sometimes that works, if the function signatures are sufficiently different, but clearly not in this case. The various ways to convert an overload-set to one of its members are described here:
https://en.cppreference.com/w/cpp/language/overloaded_address
One option is to assign to a function pointer of the correct type, which is what Quinn has done. Another is simply to cast:
auto is_empty = std::all_of(text.begin(), text.end(), static_cast<int(*)(int)>(std::isspace));
But don't do that, because of the char vs. unsigned char issue mentioned at the start.