yat  0.18pre
Public Member Functions | Friends | List of all members
theplu::yat::utility::GetlineIterator Class Reference

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

#include <yat/utility/GetlineIterator.h>

Inheritance diagram for theplu::yat::utility::GetlineIterator:

Public Member Functions

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


class boost::iterator_core_access

Detailed Description

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>:

std::ifstream is("file.txt");
std::vector<std::std::string> vec;
std::copy(begin, end, std::back_inserter(vec));
New in yat 0.6

Constructor & Destructor Documentation

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


isistream to extract string elements from.
delimiterthe delimiting character.

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

Generated on Sun Sep 27 2020 02:26:14 for yat by  doxygen 1.8.11