Removed SafeBool
diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h
index c207d8e..bcb6bd5 100644
--- a/include/internal/catch_common.h
+++ b/include/internal/catch_common.h
@@ -44,17 +44,6 @@
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<typename ContainerT>
inline void deleteAll( ContainerT& container ) {
for( auto p : container )
diff --git a/include/internal/catch_option.hpp b/include/internal/catch_option.hpp
index c9c3c16..8b146da 100644
--- a/include/internal/catch_option.hpp
+++ b/include/internal/catch_option.hpp
@@ -61,8 +61,8 @@
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 5da73aa..4197cf7 100644
--- a/include/internal/catch_ptr.hpp
+++ b/include/internal/catch_ptr.hpp
@@ -56,7 +56,7 @@
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 70c5696..05053fe 100644
--- a/projects/SelfTest/TrickyTests.cpp
+++ b/projects/SelfTest/TrickyTests.cpp
@@ -293,8 +293,8 @@
{
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;