1 stringsteam重复使用同一string
while (
std::getline(files_stream, line))
{
std::
istringstream ss(line);
string s;
vector<string> line_buf;
while (ss >> s)
line_buf.push_back(s);
ss.clear();
ss.str(line);
string name1, name2;
int id1, id2;
if (line_buf.size() ==
3) {
ss >> name1 >> id1 >> id2;
}
else if (line_buf.size() ==
4) {
ss >> name1 >> id1 >> name2 >> id2;
}
}
2 修饰符*& int *& a = ….. a是指针的引用,a发生变化对应的指针也同时发生变化
3 引用与指针转换 int a = 0; int &b = a; int *c = &b;
这里c指向a
转载请注明原文地址: https://ju.6miu.com/read-663993.html