ostreambuf_iterator::failed
Тесты сбоя вставки в буфер потока вывода.
bool failed( ) const throw( );
Возвращаемое значение
true, если вставка в буфер потока вывода не терпела ошибкой ранее; в противном случае false.
Заметки
Функция-член возвращает true если в любой прежней использовании элемента operator=, вызов _->sputcsubf возвращенных eof.
Пример
// ostreambuf_iterator_failed.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <iostream>
int main( )
{
using namespace std;
// ostreambuf_iterator for stream cout
ostreambuf_iterator<char> charOut ( cout );
*charOut = 'a';
charOut ++;
*charOut = 'b';
charOut ++;
*charOut = 'c';
cout << " are characters output individually." << endl;
bool b1 = charOut.failed ( );
if (b1)
cout << "At least one insertion failed." << endl;
else
cout << "No insertions failed." << endl;
}
Требования
заголовок: <iterator>
std пространство имен: