Skip to content

Support more generic stream input #162

@mattday

Description

@mattday

First, thanks for an excellent library. It seems to be the best in class.

CSVReader has a templated stream constructor where the template parameter can be derived from a std::istream. As the documentation suggests, this works well with std::stringstream and std::ifstream. However, it can't be used with std::istream itself, or certain other derived streams. I think this is because it tries to move the stream into the StreamParser, so the code doesn't compile if the stream doesn't support this.

It would be incredibly useful to be able to use the parser with more generic streams, giving users the ability to read from compressed files. For example, this might be via the gzip_decompressor or the bzip2_decompressor in boost::iostreams. Reading from a gzip compressed CSV file is trivial in languages like Python. It's also a common requirement given how inefficient it can be to store a lot of data in a CSV file.

It seems as though the parser can almost support this already, so it probably doesn't need significant changes.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions