isspace & isdigit explict call

The below program deletes all whitespace from the string array. I was having problems with the isspace function. After googling my issue i came up with 2 solutions using ::isspace in the global namespace or explicitly calling (int(*)int)isspace.

What iam asking is can some explain why expicit call (int(*)int))isspace works? and not just a call to isspace? what does (int(*)int)) represent?




#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <cctype>
#include <algorithm>


using namespace std;

int main()
{
string words[] = {"Scot1 ", "elena", " cotts",
"Osh ie", "midge", "enale", "eisho", "margaret", "peter", "ryan"};

vector <string> result;
int size = sizeof(words)/ sizeof(string);

for(int i = 0; i < size; i++)
words[i].erase(remove_if(words[i].begin(), words[i].end(),(int(*)(int))isspace), words[i].end());


cout << words[0];
return 0;
}
Topic archived. No new replies allowed.