std::ostreambuf_iterator
来自cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Defined in header <iterator>
|
||
| template< class CharT, class Traits = std::char_traits<CharT>> class ostreambuf_iterator : public std::iterator<std::output_iterator_tag, |
||
std::ostreambuf_iterator是连续的字符写入到std::basic_streambuf对象,它构建了一个单通输出迭代器。该迭代器时(不论是否解除引用或不)被分配给实际的写操作被执行。递增std::ostreambuf_iterator是一个no-op.Original:
std::ostreambuf_iterator is a single-pass output iterator that writes successive characters into the std::basic_streambuf object for which it was constructed. The actual write operation is performed when the iterator (whether dereferenced or not) is assigned to. Incrementing the std::ostreambuf_iterator is a no-op.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
在典型的应用中,唯一的数据成员
std::ostreambuf_iterator是一个指针,指向相关的std::basic_streambuf和一个布尔标志,表示如果文件的情况已达到.Original:
In a typical implementation, the only data members of
std::ostreambuf_iterator are a pointer to the associated std::basic_streambuf and a boolean flag indicating if the the end of file condition has been reached.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目录 |
[编辑] 会员类型
| 会员类型
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
char_type
|
CharT
|
traits_type
|
Traits
|
streambuf_type
|
std::basic_streambuf<CharT, Traits> |
ostream_type
|
std::basic_ostream<CharT, Traits> |
[编辑] 成员函数
| 构造一个新ostreambuf_iterator Original: constructs a new ostreambuf_iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员函数) | |
| (destructor) (隐式声明) |
destructs an ostreambuf_iterator (公共成员函数) |
| 将一个字符写入到相关的输出序列 Original: writes a character to the associated output sequence The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员函数) | |
| no-op (公共成员函数) | |
| no-op (公共成员函数) | |
| 测试,如果输出失败 Original: tests if output failed The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员函数) | |
Inherited from std::iterator
Member types
| 会员类型
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
value_type
|
void |
difference_type
|
void |
pointer
|
void |
reference
|
void |
iterator_category
|
std::output_iterator_tag |
[编辑] 为例
#include <string> #include <algorithm> #include <iterator> #include <iostream> int main() { std::string s = "This is an example\n"; std::copy(s.begin(), s.end(), std::ostreambuf_iterator<char>(std::cout)); }
Output:
This is an example
[编辑] 另请参阅
| 输入迭代器,读取std::basic_streambuf Original: input iterator that reads from std::basic_streambuf The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 输出迭代器,写入std::basic_ostream Original: output iterator that writes to std::basic_ostream The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |