我是 BOOST 库的新手。今天看到一小段代码,其中读写PGM格式图片是用Boost Iostreams Library实现的。随着我对 STL 越来越熟悉,我可以很容易地看出 std::fstream 可以完成同样的工作。那么我的问题是,在这样一个简单的读写PGM图像的应用程序中使用Boost库有什么意义呢?此外,我想知道在什么情况下最需要 BOOST Iostreams 库。谢谢!
最佳答案
来自 std::fstream
reference :
fstream provides an interface to read and write data from files as input/output streams.
来自 Boost.Iostreams reference :
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.
关于c++ - std::fstream 和 Boost Iostreams 库之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12251128/