diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h index c207d8e8..bcb6bd51 100644 --- a/include/internal/catch_common.h +++ b/include/internal/catch_common.h @@ -44,17 +44,6 @@ namespace Catch { virtual ~NonCopyable(); }; - class SafeBool { - public: - typedef void (SafeBool::*type)() const; - - static type makeSafe( bool value ) { - return value ? &SafeBool::trueValue : 0; - } - private: - void trueValue() const {} - }; - template inline void deleteAll( ContainerT& container ) { for( auto p : container ) diff --git a/include/internal/catch_option.hpp b/include/internal/catch_option.hpp index c9c3c165..8b146da6 100644 --- a/include/internal/catch_option.hpp +++ b/include/internal/catch_option.hpp @@ -61,8 +61,8 @@ namespace Catch { bool none() const { return nullableValue == nullptr; } bool operator !() const { return nullableValue == nullptr; } - operator SafeBool::type() const { - return SafeBool::makeSafe( some() ); + explicit operator bool() const { + return some(); } private: diff --git a/include/internal/catch_ptr.hpp b/include/internal/catch_ptr.hpp index 5da73aa1..4197cf79 100644 --- a/include/internal/catch_ptr.hpp +++ b/include/internal/catch_ptr.hpp @@ -56,7 +56,7 @@ namespace Catch { T& operator*() const { return *m_p; } T* operator->() const { return m_p; } bool operator !() const { return m_p == nullptr; } - operator SafeBool::type() const { return SafeBool::makeSafe( m_p != nullptr ); } + explicit operator bool() const { return m_p != nullptr; } private: T* m_p; diff --git a/projects/SelfTest/TrickyTests.cpp b/projects/SelfTest/TrickyTests.cpp index 70c56965..05053fe3 100644 --- a/projects/SelfTest/TrickyTests.cpp +++ b/projects/SelfTest/TrickyTests.cpp @@ -293,8 +293,8 @@ struct Boolable { explicit Boolable( bool value ) : m_value( value ) {} - operator Catch::SafeBool::type() const { - return Catch::SafeBool::makeSafe( m_value ); + explicit operator bool() const { + return m_value; } bool m_value;