S
suresh
Hi
I saw this code in the net for converting case.
string s = "Amma";
transform(s.begin(),s.end(),s.begin(),(int(*)(int))toupper);
Q: what is the meaning of (int(*)(int))toupper ?
The code works fine when (int(*)(int))toupper is replaced
by ::toupper. But the code does not even compile, when i write just
std::toupper i.e.
transform(s.begin(),s.end(),s.begin(),std::toupper); //not even
compiling
Could you please explain the difference between the three?
thanks
suresh
I saw this code in the net for converting case.
string s = "Amma";
transform(s.begin(),s.end(),s.begin(),(int(*)(int))toupper);
Q: what is the meaning of (int(*)(int))toupper ?
The code works fine when (int(*)(int))toupper is replaced
by ::toupper. But the code does not even compile, when i write just
std::toupper i.e.
transform(s.begin(),s.end(),s.begin(),std::toupper); //not even
compiling
Could you please explain the difference between the three?
thanks
suresh