【发布时间】:2011-05-13 10:51:24
【问题描述】:
我正在尝试做这样的事情:
BOOST_FOREACH (const std::string& line, allLinesOf(someFileLoadedIntoString))
{
...
}
我想知道如何实现 allLinesOf 函数?谢谢!
更新:感谢您的回答。抱歉,我忘了提及一个重要细节:在我的例子中,换行符是 \r\n。
【问题讨论】:
-
Is there a C++ iterator that can iterate over a file line by line? 的副本(不过,Jerry 对How do I iterate over
cinline by line in C++? 的回答比那个完全相同的副本要好)。