From 9b8f5bce22173f66aafa5b008ff6c5b96cdb4994 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 4 Jan 2017 18:02:39 -0500 Subject: [PATCH] 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). --- Source/Core/Common/FileUtil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h index c8524254c2..445c7fc0f4 100644 --- a/Source/Core/Common/FileUtil.h +++ b/Source/Core/Common/FileUtil.h @@ -211,7 +211,7 @@ public: bool IsOpen() const { return nullptr != m_file; } // m_good is set to false when a read, write or other function fails 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* GetHandle() { return m_file; }