c++ - what's wrong with std::remove_if in this code -


solution.cc:14:47: error: no matching function call 'remove_if(std::basic_string::iterator, std::basic_string::iterator, )'

#include <iostream> #include <algorithm> using namespace std;   int main() {     /* enter code here. read input stdin. print output stdout */        string s;     std::getline(cin, s);     std::transform(s.begin(), s.end(), s.begin(), ::tolower);     std::remove_if(s.begin(), s.end(), isspace);     // cout<<s;     int len=s.length();     len=len+90;     bool temp;     bool value[len];     for(int i=0;i<len;i++)         {            int x=(int)s[i];        if(value[x]!=1) value[x]=1;     }     for(int i=65;i<=90;i++)      if(value[i]==1) {temp=true;continue;}         else {temp=false;break;}     if(temp) cout<<"pangram"<<endl;     else cout<<"not pangram"<<endl;     return 0; } 

i tried compiling code in g++ 4.9.1. exact error is:

in function int main(): error: no matching function call 'remove_if(std::basic_string::iterator, std::basic_string::iterator, unresolved overloaded function type)'

this didn't happen call std::transform because specified tolower you're using.

isspace defined both in global namespace , in namespace std, when have using namespace std, , write isspace, there's ambiguity. specific, there's 1 overload in <cctype> , defined in <locale>.

just write ::isspace , you're go.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -