我试图从字符串中删除空格。但抛出一个错误。remove_if尝试删除空白时抛出错误
哪些参数做了我的代码为寻找
我的主要功能
#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)
你能展现包括任何'using'指令/声明? – juanchopanza
@juanchopanza添加了我的包含声明。 – user2017011
啊,'使用命名空间std'再次敲击... – juanchopanza