From 52c2f4da3d4754d78154dc05da99101a11813765 Mon Sep 17 00:00:00 2001 From: ShusenTang Date: Mon, 22 Jun 2020 17:51:57 +0800 Subject: [PATCH] add comment about istringstream --- solutions/71. Simplify Path.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/solutions/71. Simplify Path.md b/solutions/71. Simplify Path.md index bb22f88..6238b0c 100644 --- a/solutions/71. Simplify Path.md +++ b/solutions/71. Simplify Path.md @@ -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 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();