1
有沒有辦法忽略C++內聯的字符?流中的內聯忽略
例如,在this answer我讀:
istringstream foo("2000-13-30");
foo >> year;
foo.ignore();
foo >> month;
foo.ignore();
foo >> day;
但我希望能夠做到這一切在線:
foo >> year >> ignore() >> month >> ignore() >> day;
我認爲這是可能在C++中,但它絕對不是爲我編譯的。也許我記得另一種語言?
+1,我打算建議相同。但要注意,在使用通常僅用於格式化輸入的語法時,它將* formatted *輸入('>> year'等)與* unformatted input *('ignore()')混合。 – Angew 2015-04-02 13:27:51