Use CATCH_NULL instead of NULL

- expands to nullptr if CATCH_CONFIG_CPP11_NULLPTR is defined (see #444)
This commit is contained in:
Phil Nash 2015-07-01 07:33:27 +01:00
parent 3b18d9e962
commit 805de43a3d
25 changed files with 112 additions and 101 deletions

View file

@ -23,7 +23,7 @@ namespace Catch {
template<typename T>
class Ptr {
public:
Ptr() : m_p( NULL ){}
Ptr() : m_p( CATCH_NULL ){}
Ptr( T* p ) : m_p( p ){
if( m_p )
m_p->addRef();
@ -39,7 +39,7 @@ namespace Catch {
void reset() {
if( m_p )
m_p->release();
m_p = NULL;
m_p = CATCH_NULL;
}
Ptr& operator = ( T* p ){
Ptr temp( p );
@ -56,8 +56,8 @@ namespace Catch {
const T* get() const{ return m_p; }
T& operator*() const { return *m_p; }
T* operator->() const { return m_p; }
bool operator !() const { return m_p == NULL; }
operator SafeBool::type() const { return SafeBool::makeSafe( m_p != NULL ); }
bool operator !() const { return m_p == CATCH_NULL; }
operator SafeBool::type() const { return SafeBool::makeSafe( m_p != CATCH_NULL ); }
private:
T* m_p;