IOFile: Change 'operator void*' into 'explicit operator bool'

'operator void*' is basically a pre-C++11-ism that was used, as C++03
only had the notion of implicit type-conversion operators, but not explicit type
conversion operators (allowing implicit conversion of a file handle to
bool can go downhill pretty quickly).
This commit is contained in:
Lioncash 2017-01-04 18:02:39 -05:00
parent c541e1099e
commit 9b8f5bce22
1 changed files with 1 additions and 1 deletions

View File

@ -211,7 +211,7 @@ public:
bool IsOpen() const { return nullptr != m_file; } bool IsOpen() const { return nullptr != m_file; }
// m_good is set to false when a read, write or other function fails // m_good is set to false when a read, write or other function fails
bool IsGood() const { return m_good; } bool IsGood() const { return m_good; }
operator void*() { return m_good ? m_file : nullptr; } explicit operator bool() const { return IsGood(); }
std::FILE* ReleaseHandle(); std::FILE* ReleaseHandle();
std::FILE* GetHandle() { return m_file; } std::FILE* GetHandle() { return m_file; }