在线文档教程
C++
迭代器 | Iterator

std::ostreambuf_iterator::ostreambuf_iterator

STD::OStreambuf[医]迭代器::[医]迭代器

ostreambuf_iterator( streambuf_type* buffer (1)
ostreambuf_iterator( ostream_type& stream (2)

1%29使用私有构造迭代器。streambuf_type*成员设置为buffer失败的%28%29位设置为false如果buffer为空指针。

2%29ostreambuf_iterator(stream.rdbuf())

参数

stream-the output stream whose rdbuf() will be accessed by this iterator
buffer-the output stream buffer to be accessed by this iterator

例外

(none)(until C++11)
noexcept specification: noexcept(since C++11)

二次

#include <iostream> #include <fstream> #include <iterator> int main() { std::basic_filebuf<char> f; f.open("test.txt", std::ios::out std::ostreambuf_iterator<char> out1(&f std::ostreambuf_iterator<wchar_t> out2(std::wcout *out1 = 'a'; *out2 = L'a'; }

二次

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/iterator/oStreambuf[医]迭代器/OStreambuf[医]迭代器