An object of this class is automatically constructed by all member functions that perform an output operation on the stream. After being constructed, these functions evaluate the sentry object, and only continue with their output operation if true is returned.
All these member functions destruct the sentry object before returning.
The structure of this class is:
| 1 2 3 4 5 6 7 8 9 |
|
Members
- constructor: explicit sentry ( ostream& os )
- The constructor is in charge on performing the initial safety checks. Before proceeding, it checks whether none of the stream's internal error flags are set. If so, the constructor performs the appropiate operations to grant that the tied output stream is flushed before the output operation is performed on the stream.
If an error happens during this construction process, the failbit will be set, and an exception may be thrown if the member ios::exceptions is set to the appropiate value.
The private declarations of the copy constructor and assignment operator without definitions prevent constructed objects to be copied. - destructor: ~sentry
- does nothing
- operator bool() const
- When the object is evaluated, it returns a boolean value indicating whether the output sequence is ready.
Basic template member declaration
( basic_ostream<charT,traits> )| 1 2 3 4 5 6 7 8 9 10 |
|
