Why new stream library - novalexei/nstream GitHub Wiki

Why new streams library?

boost::iostreams already exists and it is simple, well designed and proven. Why not to use it? Well it is exactly what I did when I needed to write my own custom stream. But after awhile I decided to write my own framework and here is why:

  • I couldn't write with boost::iostreams what I wanted. Or, to be more precise, I could but not in the most efficient way. See "Writing input stream with in_buffer_provider" and "Writing output stream with out_buffer_provider" for more details.
  • boost::iostreams is large. It contains more than hundred files and is part of even bigger boost libraries. Yes it has a lot of useful features and this is fine to use it when you're already using other boost libraries or you need a lot of those features. But what if all you need is to convert your in/out functions or buffers into C++ streams? Looks like an overkill to me.

So how is nova::stream different from boost::iostreams?

  • nova::stream is a single include file and has no dependencies;
  • nova::stream doesn't support a lot of features supported by boost::iostreams. Important not supported features include: filters and iostream (though nova::stream supports devices shared between input and output streams - see "Input-output with shared devices")
  • nova::stream can provide buffers directly to streams which under some circumstances might improve performance and memory usage (see "Performance comparison").

Back to the Tutorial