add comment about istringstream

This commit is contained in:
ShusenTang
2020-06-22 17:51:57 +08:00
committed by GitHub
parent b420ed4bae
commit 52c2f4da3d
+2 -2
View File
@@ -32,7 +32,7 @@ istream& getline (istream&& is, string& str);
```
函数的变量:
```
is :表示一个输入流,例如cin。本题我们用到的是stringstream。
is :表示一个输入流,例如cin。本题我们用到的是stringstream或者istringstream
str :string类型的引用,用来存储输入流中的流信息。
delim :char类型的变量,所设置的截断字符;在不自定义设置的情况下,遇到’\n’,则终止输入。
```
@@ -78,7 +78,7 @@ public:
string simplifyPath(string path) {
string res, tmp;
vector<string> stk;
stringstream ss(path);
stringstream ss(path); // or istringstream ss(path);
while(getline(ss,tmp,'/')) {
if (tmp == "" or tmp == ".") continue;
if (tmp == ".." and !stk.empty()) stk.pop_back();