yat  0.10.4pre
Public Member Functions | Friends
theplu::yat::utility::GetlineIterator Class Reference

Read from std::istream with std::getline. More...

#include </scratch/bob/jari/tmp/pristine/yat-0.10.x/yat/utility/GetlineIterator.h>

List of all members.

Public Member Functions

 GetlineIterator (void)
 Constructor of end of stream iterator.
 GetlineIterator (std::istream &is, char delimiter='\n')
 Constructor.

Friends

class boost::iterator_core_access

Detailed Description

Read from std::istream with std::getline.

A GetlineIterator is an <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> similar to
std::istream_iterator that can be used to read from an \c
istream. The main difference is that GetlineIterator reads from
the istream using \c std::getline rather than \c operator>>. \c
value_type is std::string and \c operator* returns \c const \c
std::string&. When end of stream is reached iterator gets into a
special state \a end \a of \a stream. Two iterators are equal if
they are \a end \a of \a stream or if they are pointing to the
same stream (and not being \a end \a of \a stream).

Here is an example copying lines in a file to a \c vector<std::string>:
std::ifstream is("file.txt");
std::vector<std::std::string> vec;
std::copy(begin, end, std::back_inserter(vec));
Since:
New in yat 0.6

Constructor & Destructor Documentation

theplu::yat::utility::GetlineIterator::GetlineIterator ( std::istream &  is,
char  delimiter = '\n' 
)

Constructor.

Parameters:
isistream to extract string elements from.
delimiterthe delimiting character.

The documentation for this class was generated from the following file:

Generated on Mon Nov 11 2013 09:41:45 for yat by  doxygen 1.8.1