我正在尝试从字符串中删除空格。但抛出一个错误。
我的代码做错了哪个参数..感谢您的关注
我的主要功能
#include <algorithm>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
int main()
{
string myText;
myText = readText("file.txt");
myText.erase(remove_if(myText.begin(), myText.end(), isspace), myText.end());
cout << myText << endl;
return 0;
}
以下是我尝试编译时出现的错误。
encrypt.cpp: In function ‘int main()’:
encrypt.cpp:70:70: error: no matching function for call to ‘remove_if(std::basic_string<char>::iterator, std::basic_string<char>::iterator, <unresolved overloaded function type>)’
encrypt.cpp:70:70: note: candidate is:
/usr/include/c++/4.6/bits/stl_algo.h:1131:5: note: template<class _FIter, class _Predicate> _FIter std::remove_if(_FIter, _FIter, _Predicate)