C++ Boost Iostreams

来源:互联网 发布:小米笔记本12.5知乎 编辑:程序博客网 时间:2024/05/16 23:36

ostreams 库提供了一个从STL容器读取的简单方法:boost::iterator_range 实例可以直接附加到 filtering streams and stream buffers带过滤的流和流缓冲 上

namespace io = boost::iostreams;int main(){    using namespace std;    typedef my_source<string> string_source;    string input = "Hello  World";    string output;    io::stream<string_source> in(input);    getline(in,output);    assert(input == output);}

Iostreams 库提供了一个从STL容器读取的简单方法。首先,输出迭代器可以直接附加到 filtering streams and stream buffers带过滤的流和流缓冲 上

namespace io = boost::iostreams;int main(){    using namespace std;    string                 result;    io::filtering_ostream  out(io::back_inserter(result));    out << "Hello World!";    out.flush();    assert(result == "Hello World!");}
原创粉丝点击