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.
First, thanks for an excellent library. It seems to be the best in class.
CSVReaderhas a templated stream constructor where the template parameter can be derived from astd::istream. As the documentation suggests, this works well withstd::stringstreamandstd::ifstream. However, it can't be used withstd::istreamitself, or certain other derived streams. I think this is because it tries to move the stream into theStreamParser, 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_decompressoror thebzip2_decompressorinboost::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.