Skip to content
Snippets Groups Projects
Commit 9ae4ea68 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: operator bool conversion for IOstream (issue #1001)

- replaces previous pointer conversion
parent 6f16c677
No related merge requests found
...@@ -181,12 +181,12 @@ public: ...@@ -181,12 +181,12 @@ public:
// Check // Check
//- Check IOstream status for given operation //- Check IOstream status for given operation.
// print IOstream state if error has occured // Print IOstream state if error has occurred
virtual bool check(const char* operation) const; virtual bool check(const char* operation) const;
//- Check IOstream status for given operation //- Check IOstream status for given operation.
// print IOstream state if error has occured and exit // Print IOstream state if error has occurred and exit
void fatalCheck(const char* operation) const; void fatalCheck(const char* operation) const;
//- Return true if stream has been opened //- Return true if stream has been opened
...@@ -225,12 +225,10 @@ public: ...@@ -225,12 +225,10 @@ public:
return ioState_ & ios_base::badbit; return ioState_ & ios_base::badbit;
} }
//- Return non-zero if the stream has not failed //- Return true if the stream has not failed
operator void*() const explicit operator bool() const
{ {
return fail() return !fail();
? reinterpret_cast<void*>(0)
: reinterpret_cast<void*>(-1);
} }
//- Return true if the stream has failed //- Return true if the stream has failed
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment