.TH "std::basic_ostream< _CharT, _Traits >::sentry" 3cxx "Wed Jul 28 2021" "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::basic_ostream< _CharT, _Traits >::sentry \- Performs setup work for output streams\&. .SH SYNOPSIS .br .PP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBsentry\fP (\fBbasic_ostream\fP< _CharT, _Traits > &__os)" .br .RI "The constructor performs preparatory work\&. " .ti -1c .RI "\fB~sentry\fP ()" .br .RI "Possibly flushes the stream\&. " .ti -1c .RI "\fBoperator bool\fP () const" .br .RI "Quick status checking\&. " .in -1c .SH "Detailed Description" .PP .SS "template .br class std::basic_ostream< _CharT, _Traits >::sentry" Performs setup work for output streams\&. Objects of this class are created before all of the standard inserters are run\&. It is responsible for \fIexception-safe prefix and suffix operations\fP\&. .PP Definition at line 432 of file ostream\&. .SH "Constructor & Destructor Documentation" .PP .SS "template \fBstd::basic_ostream\fP< _CharT, _Traits >::sentry::sentry (\fBbasic_ostream\fP< _CharT, _Traits > & __os)\fC [explicit]\fP" .PP The constructor performs preparatory work\&. .PP \fBParameters\fP .RS 4 \fI__os\fP The output stream to guard\&. .RE .PP If the stream state is good (\fI__os\&.good()\fP is true), then if the stream is tied to another output stream, \fCis\&.tie()->flush()\fP is called to synchronize the output sequences\&. .PP If the stream state is still good, then the sentry state becomes true (\fIokay\fP)\&. .PP Definition at line 46 of file ostream\&.tcc\&. .PP References std::ios_base::failbit, std::basic_ios< _CharT, _Traits >::good(), std::basic_ios< _CharT, _Traits >::setstate(), and std::basic_ios< _CharT, _Traits >::tie()\&. .SS "template \fBstd::basic_ostream\fP< _CharT, _Traits >::sentry::~sentry ()\fC [inline]\fP" .PP Possibly flushes the stream\&. If \fCios_base::unitbuf\fP is set in \fCos\&.flags()\fP, and \fCstd::uncaught_exception()\fP is true, the sentry destructor calls \fCflush()\fP on the output stream\&. .PP Definition at line 462 of file ostream\&. .SH "Member Function Documentation" .PP .SS "template \fBstd::basic_ostream\fP< _CharT, _Traits >::sentry::operator bool () const\fC [inline]\fP, \fC [explicit]\fP" .PP Quick status checking\&. .PP \fBReturns\fP .RS 4 The sentry state\&. .RE .PP For ease of use, sentries may be converted to booleans\&. The return value is that of the sentry state (true == okay)\&. .PP Definition at line 484 of file ostream\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.