Nvwa  1.1
Classes | Namespaces
istream_line_reader.h File Reference

Header file for istream_line_reader, an easy-to-use line-based istream reader. More...

#include <assert.h>
#include <istream>
#include <iterator>
#include <string>
#include "_nvwa.h"
#include "c++11.h"
Include dependency graph for istream_line_reader.h:

Go to the source code of this file.

Classes

class  nvwa::istream_line_reader
 Class to allow iteration over all lines from an input stream. More...
 
class  nvwa::istream_line_reader::iterator
 Iterator that contains the line content. More...
 

Namespaces

 nvwa
 Namespace of the nvwa project.
 

Detailed Description

Header file for istream_line_reader, an easy-to-use line-based istream reader.

This class allows using istreams in a Pythonic way (if your compiler supports C++11 or later), e.g.:

for (auto& line : nvwa::istream_line_reader(std::cin)) {
// Process line
}

This code can be used without C++11, but using it would be less convenient then.

It was first published in a blog, and has since been modified to satisfy the InputIterator concept, along with other minor changes.

Date
2017-03-23