Namespaces
Variants
Views
Actions

std::basic_ostream::sentry

From cppreference.com
< cpp‎ | io‎ | basic ostream
Revision as of 20:34, 2 November 2012 by P12bot (Talk | contribs)

Template:cpp/io/basic ostream/sentry/navbar Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <ostream>
</td>

<td></td> <td></td> <tr class="t-dcl ">

<td class="t-dcl-nopad">
template< class CharT, class Traits = std::char_traits<CharT> >
class std::basic_istream<charT,traits>::sentry
</td>

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

An object of class basic_ostream::sentry is constructed in local scope at the beginning of each member function of std::basic_ostream that performs output (both formatted and unformatted). Its constructor prepares the output stream: checks if the stream is already in a failed state, flushes the tie()'d output streams, and performs other implementation-defined tasks if necessary. Implementation-defined cleanup, as well as flushing of the output stream if necessary, is performed in the destructor, so that it is guaranteed to happen if exceptions are thrown during output.

Member functions

Template:cpp/io/basic ostream/sentry/dcl list constructorTemplate:cpp/io/basic ostream/sentry/dcl list operator bool
finalizes the stream object after formatted output or after exception, if necessary
(public member function)
operator=
the assignment operator is deleted
(public member function)

Example


See also

Template:cpp/io/basic ostream/dcl list operator ltlt