我是BOOST图书馆的新手.今天我看到了一个小代码段,其中读取和写入PGM格式图像是通过Boost
Iostreams Library实现的.由于我对STL更熟悉,我可以轻松地告诉std :: fstream可以做同样的工作.那么我的问题是,在如此简单的阅读和编写PGM图像应用程序中使用Boost库有什么意义呢?此外,我想知道最需要BOOST Iostreams Library的情况.谢谢! 最佳答案 来自std :: fstream
reference:
fstream provides an interface to read and write data from files as
input/output streams.
Boost.Iostreams has three aims:
- To make it easy to create standard C++ streams and stream buffers for accessing new Sources and Sinks.
- To provide a framework for defining Filters and attaching them to standard streams and stream buffers.
- To provide a collection of ready-to-use Filters, Sources and Sinks.