我的问题与此类似,但那里没有示例代码,我觉得它没有用.
我的错误是
调用类'std :: __ 1 :: __ wrap_iter'的私有构造函数
我的问题的一个最小例子可以在下面找到:
#include <iostream>
#include <string>
using namespace std;
int main(){
string g = "this_word";
cout << g << endl;
char temp = g[0];
g.erase(0,1);
cout << g << endl;
g.insert(0,temp); // Compiler seems to dislike this. Why?
cout << g << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我通过两个编译器尝试了这个,并且出现了同样的错误.从标准文档中尽可能多地阅读,但不理解我的错误.