共用方式為


basic_ostream::sentry

The nested class describes an object whose declaration structures the formatted output functions and the unformatted output functions.

class sentry {
public:
    explicit sentry( basic_ostream<_Elem, _Tr>& _Ostr );
    operator bool( ) const;
    ~sentry( );
};

Remarks

The nested class describes an object whose declaration structures the formatted output functions and the unformatted output functions. If ostr.good is true and ostr.tie is not a null pointer, the constructor calls ostr.tie->flush. The constructor then stores the value returned by ostr.good in status. A later call to operator bool delivers this stored value.

If uncaught_exception returns false and flags & unitbuf is nonzero, the destructor calls flush.

Requirements

Header: <ostream>

Namespace: std

See Also

Reference

basic_ostream Class

iostream Programming

iostreams Conventions