yat
0.14.5pre
|
Read from std::istream with std::getline. More...
#include <yat/utility/GetlineIterator.h>
Public Member Functions | |
GetlineIterator (void) | |
Constructor of end of stream iterator. | |
GetlineIterator (std::istream &is, char delimiter='\n') | |
Constructor. More... | |
Friends | |
class | boost::iterator_core_access |
Read from std::istream with std::getline.
A GetlineIterator is an Input Iterator similar to std::istream_iterator that can be used to read from an istream
. The main difference is that GetlineIterator reads from the istream using std::getline
rather than operator>>
. value_type
is std::string and operator*
returns const
std::string&
. When end of stream is reached iterator gets into a special state end of stream. Two iterators are equal if they are end of stream or if they are pointing to the same stream (and not being end of stream).
Here is an example copying lines in a file to a vector<std::string>
:
|
explicit |
Constructor.
is | istream to extract string elements from. |
delimiter | the delimiting character. |